home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_src.lha / gcc-2.7.0-amiga / config / m68k / m68k.md < prev    next >
Text File  |  1995-08-24  |  204KB  |  6,986 lines

  1. ;;- Machine description for GNU compiler, Motorola 68000 Version
  2. ;;  Copyright (C) 1987, 1988, 1993, 1994, 1995 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of GNU CC.
  5.  
  6. ;; GNU CC is free software; you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; GNU CC is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;; GNU General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU CC; see the file COPYING.  If not, write to
  18. ;; the Free Software Foundation, 59 Temple Place - Suite 330,
  19. ;; Boston, MA 02111-1307, USA.
  20.  
  21.  
  22. ;;- instruction definitions
  23.  
  24. ;;- @@The original PO technology requires these to be ordered by speed,
  25. ;;- @@    so that assigner will pick the fastest.
  26.  
  27. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  28.  
  29. ;;- When naming insn's (operand 0 of define_insn) be careful about using
  30. ;;- names from other targets machine descriptions.
  31.  
  32. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  33. ;;- updates for most instructions.
  34.  
  35. ;;- Operand classes for the register allocator:
  36. ;;- 'a' one of the address registers can be used.
  37. ;;- 'd' one of the data registers can be used.
  38. ;;- 'f' one of the m68881 registers can be used
  39. ;;- 'r' either a data or an address register can be used.
  40. ;;- 'x' if one of the Sun FPA registers                    
  41. ;;- 'y' if one of the Low Sun FPA registers (fpa0-fpa15).
  42.  
  43. ;;- Immediate Floating point operator constraints
  44. ;;- 'G' a floating point constant that is *NOT* one of the standard
  45. ;;   68881 constant values (to force calling output_move_const_double
  46. ;;   to get it from rom if it is a 68881 constant).
  47. ;;- 'H' one of the standard FPA constant values
  48. ;;
  49. ;;   See the functions standard_XXX_constant_p in output-m68k.c for more
  50. ;; info.
  51.  
  52. ;;- Immediate integer operand constraints:
  53. ;;- 'I'  1 .. 8
  54. ;;- 'J'  -32768 .. 32767
  55. ;;- 'K'  all integers EXCEPT -128 .. 127
  56. ;;- 'L'  -8 .. -1
  57.  
  58. ;;- Assembler specs:
  59. ;;- "%."    size separator ("." or "")            move%.l d0,d1
  60. ;;- "%#"    immediate separator ("#" or "")        move%.l %#0,d0
  61. ;;- "%-"    push operand "sp@-"                move%.l d0,%-
  62. ;;- "%+"    pop operand "sp@+"                move%.l d0,%+
  63. ;;- "%@"    top of stack "sp@"                move%.l d0,%@
  64. ;;- "%!"    fpcr register
  65. ;;- "%$"    single-precision fp specifier ("s" or "")    f%$add.x fp0,fp1
  66. ;;- "%&"    double-precision fp specifier ("d" or "")    f%&add.x fp0,fp1
  67.  
  68. ;; UNSPEC usage:
  69. ;; 1  This is a `sin' operation.  The mode of the UNSPEC is MODE_FLOAT.
  70. ;;    operand 1 is the argument for `sin'.
  71. ;; 2  This is a `cos' operation.  The mode of the UNSPEC is MODE_FLOAT.
  72. ;;    operand 1 is the argument for `cos'.
  73.  
  74. ;;- Information about 68040 port.
  75.  
  76. ;;- The 68040 executes all 68030 and 68881/2 instructions, but some must
  77. ;;- be emulated in software by the OS.  It is faster to avoid these
  78. ;;- instructions and issue a library call rather than trapping into
  79. ;;- the kernel.  The affected instructions are fintrz and fscale.  The
  80. ;;- TARGET_68040 flag turns the use of the opcodes off.
  81.  
  82. ;;- The '040 also implements a set of new floating-point instructions
  83. ;;- which specify the rounding precision in the opcode.  This finally
  84. ;;- permit the 68k series to be truly IEEE compliant, and solves all
  85. ;;- issues of excess precision accumulating in the extended registers.
  86. ;;- By default, GCC does not use these instructions, since such code will
  87. ;;- not run on an '030.  To use these instructions, use the -m68040-only
  88. ;;- switch.  By changing TARGET_DEFAULT to include TARGET_68040_ONLY,
  89. ;;- you can make these instructions the default.
  90.  
  91. ;;- These new instructions aren't directly in the md.  They are brought
  92. ;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
  93. ;;- than "".
  94.  
  95.  
  96. ;;-         FPA port explanation:
  97.  
  98. ;;-        Usage of the Sun FPA and the 68881 together
  99.  
  100. ;;- The current port of gcc to the sun fpa disallows use of the m68881
  101. ;;- instructions completely if code is targeted for the fpa.  This is
  102. ;;- for the following reasons:
  103.  
  104. ;;- 1) Expressing the preference hierarchy (ie. use the fpa if you
  105. ;;- can, the 68881 otherwise, and data registers only if you are
  106. ;;- forced to it) is a bitch with the current constraint scheme,
  107. ;;- especially since it would have to work for any combination of
  108. ;;- -mfpa, -m68881.
  109.  
  110. ;;- 2) There are no instructions to move between the two types of
  111. ;;- registers; the stack must be used as an intermediary.
  112.  
  113. ;;- It could indeed be done; I think the best way would be to have
  114. ;;- separate patterns for TARGET_FPA (which implies a 68881),
  115. ;;- TARGET_68881, and no floating point co-processor.  Use
  116. ;;- define_expands for all of the named instruction patterns, and
  117. ;;- include code in the FPA instruction to deal with the 68881 with
  118. ;;- preferences specifically set to favor the fpa.  Some of this has
  119. ;;- already been done:
  120. ;;-
  121. ;;-     1) Separation of most of the patterns out into a TARGET_FPA
  122. ;;- case and a TARGET_68881 case (the exceptions are the patterns
  123. ;;- which would need one define_expand and three define_insn's under
  124. ;;- it (with a lot of duplicate code between them) to replace the
  125. ;;- current single define_insn.  These are mov{[ds]f,[ds]i} and the
  126. ;;- first two patterns in the md.
  127. ;;-
  128. ;;- Some would still have to be done:
  129. ;;-
  130. ;;-    1) Add code to the fpa patterns which correspond to 68881
  131. ;;- patterns to deal with the 68881 case (including preferences!).
  132. ;;- What you might actually do here is combine the fpa and 68881 code
  133. ;;- back together into one pattern for those instructions where it's
  134. ;;- absolutely necessary and save yourself some duplicate code.  I'm
  135. ;;- not completely sure as to whether you could get away with doing
  136. ;;- this only for the mov* insns, or if you'd have to do it for all
  137. ;;- named insns.
  138. ;;-     2) Add code to the mov{[ds]f,[ds]i} instructions to handle
  139. ;;- moving between fpa regs and 68881 regs.
  140.  
  141. ;;- Since the fpa is more powerful than the 68881 and also has more
  142. ;;- registers, and since I think the resultant md would be medium ugly
  143. ;;- (lot's of duplicate code, ugly constraint strings), I elected not
  144. ;;- to do this change.
  145.  
  146. ;;- Another reason why someone *might* want to do the change is to
  147. ;;- control which register classes are accessed in a slightly cleaner
  148. ;;- way than I have.  See the blurb on CONDITIONAL_REGISTER_USAGE in
  149. ;;- the internals manual.
  150.  
  151. ;;- Yet another reason why someone might want to do this change is to
  152. ;;- allow use of some of the 68881 insns which have no equivalent on
  153. ;;- the fpa.  The sqrt instruction comes fairly quickly to mind.
  154.  
  155. ;;- If this is ever done, don't forget to change sun3.h so that
  156. ;;- it *will* define __HAVE_68881__ when the FPA is in use.
  157.  
  158. ;;-        Condition code hack
  159.  
  160. ;;- When a floating point compare is done in the fpa, the resulting
  161. ;;- condition codes are left in the fpastatus register.  The values in
  162. ;;- this register must be moved into the 68000 cc register before any
  163. ;;- jump is executed.  Once this has been done, regular jump
  164. ;;- instructions are fine (ie. floating point jumps are not necessary.
  165. ;;- They are only done if the cc is in the 68881).
  166.  
  167. ;;- The instructions that move the fpastatus register to the 68000
  168. ;;- register clobber a data register (the move cannot be done direct).
  169. ;;- These instructions might be bundled either with the compare
  170. ;;- instruction, or the branch instruction.  If we were using both the
  171. ;;- fpa and the 68881 together, we would wish to only mark the
  172. ;;- register clobbered if we were doing the compare in the fpa, but I
  173. ;;- think that that decision (whether to clobber the register or not)
  174. ;;- must be done before register allocation (makes sense) and hence we
  175. ;;- can't know if the floating point compare will be done in the fpa
  176. ;;- or the fp.  So whenever we are asked for code that uses the fpa,
  177. ;;- we will mark a data register as clobbered.  This is reasonable, as
  178. ;;- almost all floating point compare operations done with fpa code
  179. ;;- enabled will be done in the fpa.  It's even more reasonable since
  180. ;;- we decided to make the 68881 and the fpa mutually exclusive.
  181.  
  182. ;;- We place to code to move the fpastatus register inside of a
  183. ;;- define_expand so that we can do it conditionally based on whether
  184. ;;- we are targeting an fpa or not.
  185.  
  186. ;;- This still leaves us with the question of where we wish to put the
  187. ;;- code to move the fpastatus reg.  If we put it in the compare
  188. ;;- instruction, we can restrict the clobbering of the register to
  189. ;;- floating point compares, but we can't take advantage of floating
  190. ;;- point subtracts & etc. that alter the fpastatus register.  If we
  191. ;;- put it in the branch instruction, all branches compiled with fpa
  192. ;;- code enabled will clobber a data register, but we will be able to
  193. ;;- take advantage of fpa subtracts.  This balance favors putting the
  194. ;;- code in with the compare instruction.
  195.  
  196. ;;- Note that if some enterprising hacker should decide to switch
  197. ;;- this, he'll need to modify the code in NOTICE_UPDATE_CC.
  198.  
  199. ;;-        Usage of the top 16 fpa registers
  200.  
  201. ;;- The only locations which we may transfer fpa registers 16-31 from
  202. ;;- or to are the fpa registers 0-15.  (68000 registers and memory
  203. ;;- locations are impossible).  This causes problems in gcc, which
  204. ;;- assumes that mov?? instructions require no additional registers
  205. ;;- (see section 11.7) and since floating point moves *must* be
  206. ;;- supported into general registers (see section 12.3 under
  207. ;;- HARD_REGNO_OK_FOR_MODE_P) from anywhere.
  208.  
  209. ;;- My solution was to reserve fpa0 for moves into or out of these top
  210. ;;- 16 registers and to disparage the choice to reload into or out of
  211. ;;- these registers as much as I could.  That alternative is always
  212. ;;- last in the list, so it will not be used unless all else fails.  I
  213. ;;- will note that according to my current information, sun's compiler
  214. ;;- doesn't use these top 16 registers at all.
  215.  
  216. ;;- There is another possible way to do it.  I *believe* that if you
  217. ;;- make absolutely sure that the code will not be executed in the
  218. ;;- reload pass, you can support the mov?? names with define_expands
  219. ;;- which require new registers.  This may be possible by the
  220. ;;- appropriate juggling of constraints.  I may come back to this later.
  221.  
  222. ;;-         Usage of constant RAM
  223.  
  224. ;;- This has been handled correctly (I believe) but the way I've done
  225. ;;- it could use a little explanation.  The constant RAM can only be
  226. ;;- accessed when the instruction is in "command register" mode.
  227. ;;- "command register" mode means that no accessing of memory or the
  228. ;;- 68000 registers is being done.  This can be expressed easily in
  229. ;;- constraints, so generally the mode of the instruction is
  230. ;;- determined by a branch off of which_alternative.  In outputting
  231. ;;- instructions, a 'w' means to output an access to the constant ram
  232. ;;- (if the arg is CONST_DOUBLE and is one of the available
  233. ;;- constants), and 'x' means to output a register pair (if the arg is
  234. ;;- a 68000 register) and a 'y' is the combination of the above two
  235. ;;- processes.  You use a 'y' in two operand DF instructions where you
  236. ;;- *know* the other operand is an fpa register, you use an 'x' in DF
  237. ;;- instructions where the arg might be a 68000 register and the
  238. ;;- instruction is *not* in "command register" mode, and you use a 'w'
  239. ;;- in two situations: 1) The instruction *is* in command register
  240. ;;- mode (and hence won't be accessing 68000 registers), or 2) The
  241. ;;- instruction is a two operand SF instruction where you know the
  242. ;;- other operand is an fpa register.
  243.  
  244. ;;-        Optimization issues
  245.  
  246. ;;- I actually think that I've included all of the fpa instructions
  247. ;;- that should be included.  Note that if someone is interested in
  248. ;;- doing serious floating point work on the sun fpa, I would advise
  249. ;;- the use of the "asm" instruction in gcc to allow you to use the
  250. ;;- sin, cos, and exponential functions on the fpa board.
  251.  
  252. ;;- END FPA Explanation Section.
  253.  
  254.  
  255. ;;- Some of these insn's are composites of several m68000 op codes.
  256. ;;- The assembler (or final @@??) insures that the appropriate one is
  257. ;;- selected.
  258.  
  259. (define_insn ""
  260.   [(set (match_operand:DF 0 "push_operand" "=m")
  261.     (match_operand:DF 1 "general_operand" "ro<>fyE"))]
  262.   ""
  263.   "*
  264. {
  265.   if (FP_REG_P (operands[1]))
  266.     return \"fmove%.d %f1,%0\";
  267.   if (FPA_REG_P (operands[1]))
  268.     return \"fpmove%.d %1, %x0\";
  269.   return output_move_double (operands);
  270. }")
  271.  
  272. (define_insn ""
  273.   [(set (match_operand:DI 0 "push_operand" "=m")
  274.     (match_operand:DI 1 "general_operand" "ro<>Fy"))]
  275.   ""
  276.   "*
  277. {
  278.   return output_move_double (operands);
  279. }")
  280.  
  281. ;; We don't want to allow a constant operand for test insns because
  282. ;; (set (cc0) (const_int foo)) has no mode information.  Such insns will
  283. ;; be folded while optimizing anyway.
  284.  
  285. (define_expand "tstdi"
  286.   [(parallel
  287.     [(set (cc0)
  288.       (match_operand:DI 0 "nonimmediate_operand" "d"))
  289.    (clobber (match_dup 1))])]
  290.   ""
  291.   "
  292. {
  293.   operands[1] = gen_reg_rtx (DImode);
  294. }")
  295.  
  296. (define_insn ""
  297.   [(set (cc0)
  298.     (match_operand:DI 1 "nonimmediate_operand" "0"))
  299.    (clobber (match_operand:DI 0 "register_operand" "=d"))]
  300.   ""
  301.   "*
  302. {
  303.   cc_status.flags |= CC_REVERSED;
  304.   return \"neg%.l %R0\;negx%.l %0\";
  305. }")
  306.  
  307. (define_insn "tstsi"
  308.   [(set (cc0)
  309.     (match_operand:SI 0 "nonimmediate_operand" "rm"))]
  310.   ""
  311.   "*
  312. {
  313. #ifdef ISI_OV
  314.   /* ISI's assembler fails to handle tstl a0.  */
  315.   if (! ADDRESS_REG_P (operands[0]))
  316. #else
  317.   if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
  318. #endif
  319.     return \"tst%.l %0\";
  320.   /* If you think that the 68020 does not support tstl a0,
  321.      reread page B-167 of the 68020 manual more carefully.  */
  322.   /* On an address reg, cmpw may replace cmpl.  */
  323. #ifdef SGS_CMP_ORDER
  324.   return \"cmp%.w %0,%#0\";
  325. #else
  326.   return \"cmp%.w %#0,%0\";
  327. #endif
  328. }")
  329.  
  330. ;; This can't use an address register, because comparisons
  331. ;; with address registers as second operand always test the whole word.
  332. (define_insn "tsthi"
  333.   [(set (cc0)
  334.     (match_operand:HI 0 "nonimmediate_operand" "dm"))]
  335.   ""
  336.   "tst%.w %0")
  337.  
  338. (define_insn "tstqi"
  339.   [(set (cc0)
  340.     (match_operand:QI 0 "nonimmediate_operand" "dm"))]
  341.   ""
  342.   "tst%.b %0")
  343.   
  344. (define_expand "tstsf"
  345.   [(set (cc0)
  346.     (match_operand:SF 0 "general_operand" ""))]
  347.   "TARGET_68881 || TARGET_FPA"
  348.   "
  349. {
  350.   if (TARGET_FPA)
  351.     {
  352.       emit_insn (gen_tstsf_fpa (operands[0]));
  353.       DONE;
  354.     }
  355. }")
  356.  
  357. (define_insn "tstsf_fpa"
  358.   [(set (cc0)
  359.     (match_operand:SF 0 "general_operand" "xmdF"))
  360.    (clobber (match_scratch:SI 1 "=d"))]
  361.   "TARGET_FPA"
  362.   "fptst%.s %x0\;fpmove fpastatus,%1\;movw %1,cc")
  363.  
  364. (define_insn ""
  365.   [(set (cc0)
  366.     (match_operand:SF 0 "general_operand" "fdm"))]
  367.   "TARGET_68881"
  368.   "*
  369. {
  370.   cc_status.flags = CC_IN_68881;
  371.   if (FP_REG_P (operands[0]))
  372.     return \"ftst%.x %0\";
  373.   return \"ftst%.s %0\";
  374. }")
  375.  
  376. (define_expand "tstdf"
  377.   [(set (cc0)
  378.     (match_operand:DF 0 "general_operand" ""))]
  379.   "TARGET_68881 || TARGET_FPA"
  380.   "
  381. {
  382.   if (TARGET_FPA)
  383.     {
  384.       emit_insn (gen_tstsf_fpa (operands[0]));
  385.       DONE;
  386.     }
  387. }")
  388.  
  389. (define_insn "tstdf_fpa"
  390.   [(set (cc0)
  391.     (match_operand:DF 0 "general_operand" "xrmF"))
  392.    (clobber (match_scratch:SI 1 "=d"))]
  393.   "TARGET_FPA"
  394.   "fptst%.d %x0\;fpmove fpastatus,%1\;movw %1,cc")
  395.  
  396. (define_insn ""
  397.   [(set (cc0)
  398.     (match_operand:DF 0 "general_operand" "fm"))]
  399.   "TARGET_68881"
  400.   "*
  401. {
  402.   cc_status.flags = CC_IN_68881;
  403.   if (FP_REG_P (operands[0]))
  404.     return \"ftst%.x %0\";
  405.   return \"ftst%.d %0\";
  406. }")
  407.  
  408. ;; compare instructions.
  409.  
  410. (define_expand "cmpdi"
  411.   [(parallel
  412.     [(set (cc0)
  413.       (compare (match_operand:DI 0 "nonimmediate_operand" "")
  414.            (match_operand:DI 1 "general_operand" "")))
  415.      (clobber (match_dup 2))])]
  416.   ""
  417.   "
  418. {
  419.   operands[2] = gen_reg_rtx (DImode);
  420. }")
  421.  
  422. (define_insn ""
  423.   [(set (cc0)
  424.     (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
  425.          (match_operand:DI 2 "general_operand" "d,0")))
  426.    (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
  427.   ""
  428.   "*
  429. {
  430.   if (rtx_equal_p (operands[0], operands[1]))
  431.     return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
  432.   else
  433.     {
  434.       cc_status.flags |= CC_REVERSED;
  435.       return \"sub%.l %R1,%R0\;subx%.l %1,%0\";
  436.     }
  437. }")
  438.  
  439. ;; This is the second "hook" for PIC code (in addition to movsi). See
  440. ;; comment of movsi for a description of PIC handling.
  441. (define_expand "cmpsi"
  442.   [(set (cc0)
  443.     (compare (match_operand:SI 0 "nonimmediate_operand" "")
  444.          (match_operand:SI 1 "general_operand" "")))]
  445.   ""
  446.   "
  447. {
  448.   if (flag_pic && symbolic_operand (operands[1], SImode)
  449. #ifdef LEGITIMATE_BASEREL_OPERAND_P
  450.       && (flag_pic < 3 || !LEGITIMATE_BASEREL_OPERAND_P (operands[1]))
  451. #endif
  452.      )
  453.     {
  454.       /* The source is an address which requires PIC relocation.  
  455.          Call legitimize_pic_address with the source, mode, and a relocation
  456.          register (a new pseudo, or the final destination if reload_in_progress
  457.          is set).   Then fall through normally */
  458.       extern rtx legitimize_pic_address();
  459.       rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
  460.       operands[1] = legitimize_pic_address (operands[1], SImode, temp);
  461.     }
  462. }")
  463.  
  464. ;; A composite of the cmp, cmpa, & cmpi m68000 op codes.
  465. (define_insn ""
  466.   [(set (cc0)
  467.     (compare (match_operand:SI 0 "nonimmediate_operand" "rKs,mr,>")
  468.          (match_operand:SI 1 "general_operand" "mr,Ksr,>")))]
  469.   ""
  470.   "*
  471. {
  472.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  473. #ifdef SGS_CMP_ORDER
  474.     return \"cmpm%.l %0,%1\";
  475. #else
  476.     return \"cmpm%.l %1,%0\";
  477. #endif
  478.   if (REG_P (operands[1])
  479.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  480.     { cc_status.flags |= CC_REVERSED;
  481. #ifdef SGS_CMP_ORDER
  482.       return \"cmp%.l %d1,%d0\";
  483. #else
  484.       return \"cmp%.l %d0,%d1\";
  485. #endif
  486.     }
  487. #ifdef SGS_CMP_ORDER
  488.   return \"cmp%.l %d0,%d1\";
  489. #else
  490.   return \"cmp%.l %d1,%d0\";
  491. #endif
  492. }")
  493.  
  494. (define_insn "cmphi"
  495.   [(set (cc0)
  496.     (compare (match_operand:HI 0 "nonimmediate_operand" "rnm,d,n,m,>")
  497.          (match_operand:HI 1 "general_operand" "d,rnm,m,n,>")))]
  498.   ""
  499.   "*
  500. {
  501.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  502. #ifdef SGS_CMP_ORDER
  503.     return \"cmpm%.w %0,%1\";
  504. #else
  505.     return \"cmpm%.w %1,%0\";
  506. #endif
  507.   if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
  508.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  509.     { cc_status.flags |= CC_REVERSED;
  510. #ifdef SGS_CMP_ORDER
  511.       return \"cmp%.w %d1,%d0\";
  512. #else
  513.       return \"cmp%.w %d0,%d1\";
  514. #endif
  515.     }
  516. #ifdef SGS_CMP_ORDER
  517.   return \"cmp%.w %d0,%d1\";
  518. #else
  519.   return \"cmp%.w %d1,%d0\";
  520. #endif
  521. }")
  522.  
  523. (define_insn "cmpqi"
  524.   [(set (cc0)
  525.     (compare (match_operand:QI 0 "nonimmediate_operand" "dn,md,>")
  526.          (match_operand:QI 1 "general_operand" "dm,nd,>")))]
  527.   ""
  528.   "*
  529. {
  530.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  531. #ifdef SGS_CMP_ORDER
  532.     return \"cmpm%.b %0,%1\";
  533. #else
  534.     return \"cmpm%.b %1,%0\";
  535. #endif
  536.   if (REG_P (operands[1])
  537.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  538.     { cc_status.flags |= CC_REVERSED;
  539. #ifdef SGS_CMP_ORDER
  540.       return \"cmp%.b %d1,%d0\";
  541. #else
  542.       return \"cmp%.b %d0,%d1\";
  543. #endif
  544.     }
  545. #ifdef SGS_CMP_ORDER
  546.   return \"cmp%.b %d0,%d1\";
  547. #else
  548.   return \"cmp%.b %d1,%d0\";
  549. #endif
  550. }")
  551.  
  552. (define_expand "cmpdf"
  553.   [(set (cc0)
  554.     (compare (match_operand:DF 0 "general_operand" "")
  555.          (match_operand:DF 1 "general_operand" "")))]
  556.   "TARGET_68881 || TARGET_FPA"
  557.   "
  558. {
  559.   if (TARGET_FPA)
  560.     {
  561.       emit_insn (gen_cmpdf_fpa (operands[0], operands[1]));
  562.       DONE;
  563.     }
  564. }")
  565.  
  566. (define_insn "cmpdf_fpa"
  567.   [(set (cc0)
  568.     (compare (match_operand:DF 0 "general_operand" "x,y")
  569.          (match_operand:DF 1 "general_operand" "xH,rmF")))
  570.    (clobber (match_scratch:SI 2 "=d,d"))]
  571.   "TARGET_FPA"
  572.   "fpcmp%.d %y1,%0\;fpmove fpastatus,%2\;movw %2,cc")
  573.  
  574. (define_insn ""
  575.   [(set (cc0)
  576.     (compare (match_operand:DF 0 "general_operand" "f,mG")
  577.          (match_operand:DF 1 "general_operand" "fmG,f")))]
  578.   "TARGET_68881"
  579.   "*
  580. {
  581.   cc_status.flags = CC_IN_68881;
  582. #ifdef SGS_CMP_ORDER
  583.   if (REG_P (operands[0]))
  584.     {
  585.       if (REG_P (operands[1]))
  586.     return \"fcmp%.x %0,%1\";
  587.       else
  588.         return \"fcmp%.d %0,%f1\";
  589.     }
  590.   cc_status.flags |= CC_REVERSED;
  591.   return \"fcmp%.d %1,%f0\";
  592. #else
  593.   if (REG_P (operands[0]))
  594.     {
  595.       if (REG_P (operands[1]))
  596.     return \"fcmp%.x %1,%0\";
  597.       else
  598.         return \"fcmp%.d %f1,%0\";
  599.     }
  600.   cc_status.flags |= CC_REVERSED;
  601.   return \"fcmp%.d %f0,%1\";
  602. #endif
  603. }")
  604.  
  605. (define_expand "cmpsf"
  606.  [(set (cc0)
  607.        (compare (match_operand:SF 0 "general_operand" "")
  608.         (match_operand:SF 1 "general_operand" "")))]
  609.  "TARGET_68881 || TARGET_FPA"
  610.  "
  611. {
  612.   if (TARGET_FPA)
  613.     {
  614.       emit_insn (gen_cmpsf_fpa (operands[0], operands[1]));
  615.       DONE;
  616.     }
  617. }")
  618.  
  619. (define_insn "cmpsf_fpa"
  620.   [(set (cc0)
  621.     (compare (match_operand:SF 0 "general_operand" "x,y")
  622.          (match_operand:SF 1 "general_operand" "xH,rmF")))
  623.    (clobber (match_scratch:SI 2 "=d,d"))]
  624.   "TARGET_FPA"
  625.   "fpcmp%.s %w1,%x0\;fpmove fpastatus,%2\;movw %2,cc")
  626.  
  627. (define_insn ""
  628.   [(set (cc0)
  629.     (compare (match_operand:SF 0 "general_operand" "f,mdG")
  630.          (match_operand:SF 1 "general_operand" "fmdG,f")))]
  631.   "TARGET_68881"
  632.   "*
  633. {
  634.   cc_status.flags = CC_IN_68881;
  635. #ifdef SGS_CMP_ORDER
  636.   if (FP_REG_P (operands[0]))
  637.     {
  638.       if (FP_REG_P (operands[1]))
  639.     return \"fcmp%.x %0,%1\";
  640.       else
  641.         return \"fcmp%.s %0,%f1\";
  642.     }
  643.   cc_status.flags |= CC_REVERSED;
  644.   return \"fcmp%.s %1,%f0\";
  645. #else
  646.   if (FP_REG_P (operands[0]))
  647.     {
  648.       if (FP_REG_P (operands[1]))
  649.     return \"fcmp%.x %1,%0\";
  650.       else
  651.         return \"fcmp%.s %f1,%0\";
  652.     }
  653.   cc_status.flags |= CC_REVERSED;
  654.   return \"fcmp%.s %f0,%1\";
  655. #endif
  656. }")
  657.  
  658. ;; Recognizers for btst instructions.
  659.  
  660. (define_insn ""
  661.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  662.                 (const_int 1)
  663.                 (minus:SI (const_int 7)
  664.                       (match_operand:SI 1 "general_operand" "di"))))]
  665.   ""
  666.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  667.  
  668. (define_insn ""
  669.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  670.                 (const_int 1)
  671.                 (minus:SI (const_int 31)
  672.                       (match_operand:SI 1 "general_operand" "di"))))]
  673.   ""
  674.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  675.  
  676. ;; The following two patterns are like the previous two
  677. ;; except that they use the fact that bit-number operands
  678. ;; are automatically masked to 3 or 5 bits.
  679.  
  680. (define_insn ""
  681.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  682.                 (const_int 1)
  683.                 (minus:SI (const_int 7)
  684.                       (and:SI
  685.                        (match_operand:SI 1 "register_operand" "d")
  686.                        (const_int 7)))))]
  687.   ""
  688.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  689.  
  690. (define_insn ""
  691.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  692.                 (const_int 1)
  693.                 (minus:SI (const_int 31)
  694.                       (and:SI
  695.                        (match_operand:SI 1 "register_operand" "d")
  696.                        (const_int 31)))))]
  697.   ""
  698.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  699.  
  700. ;; Nonoffsettable mem refs are ok in this one pattern
  701. ;; since we don't try to adjust them.
  702. (define_insn ""
  703.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "md")
  704.                 (const_int 1)
  705.                 (match_operand:SI 1 "const_int_operand" "n")))]
  706.   "(unsigned) INTVAL (operands[1]) < 8"
  707.   "*
  708. {
  709.   operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]));
  710.   return output_btst (operands, operands[1], operands[0], insn, 7);
  711. }")
  712.  
  713. (define_insn ""
  714.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "do")
  715.                 (const_int 1)
  716.                 (match_operand:SI 1 "const_int_operand" "n")))]
  717.   ""
  718.   "*
  719. {
  720.   if (GET_CODE (operands[0]) == MEM)
  721.     {
  722.       operands[0] = adj_offsettable_operand (operands[0],
  723.                          INTVAL (operands[1]) / 8);
  724.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  725.                  7 - INTVAL (operands[1]) % 8);
  726.       return output_btst (operands, operands[1], operands[0], insn, 7);
  727.     }
  728.   operands[1] = gen_rtx (CONST_INT, VOIDmode,
  729.              31 - INTVAL (operands[1]));
  730.   return output_btst (operands, operands[1], operands[0], insn, 31);
  731. }")
  732.  
  733.  
  734. ;; move instructions
  735.  
  736. ;; A special case in which it is not desirable
  737. ;; to reload the constant into a data register.
  738. (define_insn ""
  739.   [(set (match_operand:SI 0 "push_operand" "=m")
  740.     (match_operand:SI 1 "const_int_operand" "J"))]
  741.   "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
  742.   "*
  743. {
  744.   if (operands[1] == const0_rtx)
  745.     return \"clr%.l %0\";
  746.   return \"pea %a1\";
  747. }")
  748.  
  749. ;This is never used.
  750. ;(define_insn "swapsi"
  751. ;  [(set (match_operand:SI 0 "general_operand" "+r")
  752. ;    (match_operand:SI 1 "general_operand" "+r"))
  753. ;   (set (match_dup 1) (match_dup 0))]
  754. ;  ""
  755. ;  "exg %1,%0")
  756.  
  757. ;; Special case of fullword move when source is zero.
  758. ;; The reason this is special is to avoid loading a zero
  759. ;; into a data reg with moveq in order to store it elsewhere.
  760.    
  761. (define_insn ""
  762.   [(set (match_operand:SI 0 "general_operand" "=g")
  763.     (const_int 0))]
  764.   ;; clr insns on 68000 read before writing.
  765.   ;; This isn't so on the 68010, but we have no alternative for it.
  766.   "(TARGET_68020
  767.     || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
  768.   "*
  769. {
  770.   if (ADDRESS_REG_P (operands[0]))
  771.     return \"sub%.l %0,%0\";
  772.   /* moveq is faster on the 68000.  */
  773.   if (DATA_REG_P (operands[0]) && !TARGET_68020)
  774. #if defined(MOTOROLA) && !defined(CRDS)
  775.     return \"moveq%.l %#0,%0\";
  776. #else
  777.     return \"moveq %#0,%0\";
  778. #endif
  779.   return \"clr%.l %0\";
  780. }")
  781.  
  782. ;; General case of fullword move. 
  783. ;;
  784. ;; This is the main "hook" for PIC code.  When generating
  785. ;; PIC, movsi is responsible for determining when the source address
  786. ;; needs PIC relocation and appropriately calling legitimize_pic_address
  787. ;; to perform the actual relocation.
  788. ;;
  789. ;; In both the PIC and non-PIC cases the patterns generated will
  790. ;; matched by the next define_insn. 
  791. (define_expand "movsi"
  792.   [(set (match_operand:SI 0 "general_operand" "")
  793.     (match_operand:SI 1 "general_operand" ""))]
  794.   ""
  795.   "
  796. {
  797.   if (flag_pic && symbolic_operand (operands[1], SImode)) 
  798.     {
  799. #ifdef LEGITIMATE_BASEREL_OPERAND_P
  800.       if (flag_pic < 3 || !LEGITIMATE_BASEREL_OPERAND_P (operands[1]))
  801. #endif
  802.       {
  803.         /* The source is an address which requires PIC relocation.  
  804.            Call legitimize_pic_address with the source, mode, and a relocation
  805.            register (a new pseudo, or the final destination if reload_in_progress
  806.            is set).   Then fall through normally */
  807.         extern rtx legitimize_pic_address();
  808.         rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
  809.         operands[1] = legitimize_pic_address (operands[1], SImode, temp);
  810.       }
  811.     }
  812. }")
  813.  
  814. ;; General case of fullword move.  The register constraints
  815. ;; force integer constants in range for a moveq to be reloaded
  816. ;; if they are headed for memory.
  817. (define_insn ""
  818.   ;; Notes: make sure no alternative allows g vs g.
  819.   ;; We don't allow f-regs since fixed point cannot go in them.
  820.   ;; We do allow y and x regs since fixed point is allowed in them.
  821.   [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m")
  822.     (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))]
  823.   ""
  824.   "*
  825. {
  826.   if (which_alternative == 3)
  827.     return \"fpmove%.l %x1,fpa0\;fpmove%.l fpa0,%x0\";    
  828.   if (FPA_REG_P (operands[1]) || FPA_REG_P (operands[0]))
  829.     return \"fpmove%.l %x1,%x0\";
  830.   if (GET_CODE (operands[1]) == CONST_INT)
  831.     {
  832.       if (operands[1] == const0_rtx
  833.       && (DATA_REG_P (operands[0])
  834.           || GET_CODE (operands[0]) == MEM)
  835.       /* clr insns on 68000 read before writing.
  836.          This isn't so on the 68010, but we have no alternative for it.  */
  837.       && (TARGET_68020
  838.           || !(GET_CODE (operands[0]) == MEM
  839.            && MEM_VOLATILE_P (operands[0]))))
  840.     return \"clr%.l %0\";
  841.       else if (DATA_REG_P (operands[0]))
  842.     return output_move_const_into_data_reg (operands);
  843.       else if (ADDRESS_REG_P (operands[0])
  844.            && INTVAL (operands[1]) < 0x8000
  845.            && INTVAL (operands[1]) >= -0x8000)
  846.     return \"move%.w %1,%0\";
  847.       else if (push_operand (operands[0], SImode)
  848.            && INTVAL (operands[1]) < 0x8000
  849.            && INTVAL (operands[1]) >= -0x8000)
  850.         return \"pea %a1\";
  851.     }
  852.   else if ((GET_CODE (operands[1]) == SYMBOL_REF
  853.         || GET_CODE (operands[1]) == CONST)
  854.        && push_operand (operands[0], SImode))
  855.     return \"pea %a1\";
  856.   else if ((GET_CODE (operands[1]) == SYMBOL_REF
  857.         || GET_CODE (operands[1]) == CONST)
  858.        && ADDRESS_REG_P (operands[0]))
  859.     return \"lea %a1,%0\";
  860.   return \"move%.l %1,%0\";
  861. }")
  862.  
  863. (define_insn "movhi"
  864.   [(set (match_operand:HI 0 "general_operand" "=g")
  865.     (match_operand:HI 1 "general_operand" "g"))]
  866.   ""
  867.   "*
  868. {
  869.   if (GET_CODE (operands[1]) == CONST_INT)
  870.     {
  871.       if (operands[1] == const0_rtx
  872.       && (DATA_REG_P (operands[0])
  873.           || GET_CODE (operands[0]) == MEM)
  874.       /* clr insns on 68000 read before writing.
  875.          This isn't so on the 68010, but we have no alternative for it.  */
  876.       && (TARGET_68020
  877.           || !(GET_CODE (operands[0]) == MEM
  878.            && MEM_VOLATILE_P (operands[0]))))
  879.     return \"clr%.w %0\";
  880.       else if (DATA_REG_P (operands[0])
  881.            && INTVAL (operands[1]) < 128
  882.            && INTVAL (operands[1]) >= -128)
  883.         {
  884. #if defined(MOTOROLA) && !defined(CRDS)
  885.           return \"moveq%.l %1,%0\";
  886. #else
  887.       return \"moveq %1,%0\";
  888. #endif
  889.     }
  890.       else if (INTVAL (operands[1]) < 0x8000
  891.            && INTVAL (operands[1]) >= -0x8000)
  892.     return \"move%.w %1,%0\";
  893.     }
  894.   else if (CONSTANT_P (operands[1]))
  895.     return \"move%.l %1,%0\";
  896. #ifndef SGS_NO_LI
  897.   /* Recognize the insn before a tablejump, one that refers
  898.      to a table of offsets.  Such an insn will need to refer
  899.      to a label on the insn.  So output one.  Use the label-number
  900.      of the table of offsets to generate this label.  This code,
  901.      and similar code below, assumes that there will be at most one
  902.      reference to each table.  */
  903.   if (GET_CODE (operands[1]) == MEM
  904.       && GET_CODE (XEXP (operands[1], 0)) == PLUS
  905.       && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF
  906.       && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS)
  907.     {
  908.       rtx labelref = XEXP (XEXP (operands[1], 0), 1);
  909. #if defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES)
  910. #ifdef SGS
  911.       asm_fprintf (asm_out_file, \"\\tset %LLI%d,.+2\\n\",
  912.            CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  913. #else /* not SGS */
  914.       asm_fprintf (asm_out_file, \"\\t.set %LLI%d,.+2\\n\",
  915.                CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  916. #endif /* not SGS */
  917. #else /* SGS_SWITCH_TABLES or not MOTOROLA */
  918.       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
  919.                  CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  920. #ifdef SGS_SWITCH_TABLES
  921.       /* Set flag saying we need to define the symbol
  922.      LD%n (with value L%n-LI%n) at the end of the switch table.  */
  923.       switch_table_difference_label_flag = 1;
  924. #endif /* SGS_SWITCH_TABLES */
  925. #endif /* SGS_SWITCH_TABLES or not MOTOROLA */
  926.     }
  927. #endif /* SGS_NO_LI */
  928.   return \"move%.w %1,%0\";
  929. }")
  930.  
  931. (define_insn "movstricthi"
  932.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  933.     (match_operand:HI 1 "general_operand" "rmn"))]
  934.   ""
  935.   "*
  936. {
  937.   if (GET_CODE (operands[1]) == CONST_INT)
  938.     {
  939.       if (operands[1] == const0_rtx
  940.       && (DATA_REG_P (operands[0])
  941.           || GET_CODE (operands[0]) == MEM)
  942.       /* clr insns on 68000 read before writing.
  943.          This isn't so on the 68010, but we have no alternative for it.  */
  944.       && (TARGET_68020
  945.           || !(GET_CODE (operands[0]) == MEM
  946.            && MEM_VOLATILE_P (operands[0]))))
  947.     return \"clr%.w %0\";
  948.     }
  949.   return \"move%.w %1,%0\";
  950. }")
  951.  
  952. (define_insn "movqi"
  953.   [(set (match_operand:QI 0 "general_operand" "=d,*a,m,m,?*a")
  954.     (match_operand:QI 1 "general_operand" "dmi*a,d*a,dmi,?*a,m"))]
  955.   ""
  956.   "*
  957. {
  958.   rtx xoperands[4];
  959.  
  960.   /* This is probably useless, since it loses for pushing a struct
  961.      of several bytes a byte at a time.  */
  962.   if (GET_CODE (operands[0]) == MEM
  963.       && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
  964.       && XEXP (XEXP (operands[0], 0), 0) == stack_pointer_rtx
  965.       && ! ADDRESS_REG_P (operands[1]))
  966.     {
  967.       xoperands[1] = operands[1];
  968.       xoperands[2]
  969.         = gen_rtx (MEM, QImode,
  970.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
  971.       /* Just pushing a byte puts it in the high byte of the halfword.  */
  972.       /* We must put it in the low-order, high-numbered byte.  */
  973.       output_asm_insn (\"move%.b %1,%-\;move%.b %@,%2\", xoperands);
  974.       return \"\";
  975.     }
  976.  
  977.   /* Moving a byte into an address register is not possible.  */
  978.   /* Use d0 as an intermediate, but don't clobber its contents.  */
  979.   if (ADDRESS_REG_P (operands[0]) && GET_CODE (operands[1]) == MEM)
  980.     {
  981.       /* ??? For 2.5, don't allow this choice and use secondary reloads
  982.      instead.
  983.  
  984.      See if the address register is used in the address.  If it
  985.      is, we have to generate a more complex sequence than those below.  */
  986.       if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
  987.                  operands[1], NULL_RTX))
  988.     {
  989.       /* See if the stack pointer is used in the address.  If it isn't,
  990.          we can push d0 or d1 (the insn can't use both of them) on
  991.          the stack, perform our move into d0/d1, copy the byte from d0/1,
  992.          and pop d0/1.  */
  993.       if (! reg_mentioned_p (stack_pointer_rtx, operands[1]))
  994.         {
  995.           if (! refers_to_regno_p (0, 1, operands[1], NULL_RTX))
  996.         return \"move%.l %/d0,%-\;move%.b %1,%/d0\;move%.l %/d0,%0\;move%.l %+,%/d0\";
  997.           else
  998.         return \"move%.l %/d1,%-\;move%.b %1,%/d1\;move%.l %/d1,%0\;move%.l %+,%/d1\";
  999.         }
  1000.       else
  1001.         {
  1002.           /* Otherwise, we know that d0 cannot be used in the address
  1003.          (since sp and one address register is).  Assume that sp is
  1004.          being used as a base register and replace the address
  1005.          register that is our operand[0] with d0.  */
  1006.           rtx reg_map[FIRST_PSEUDO_REGISTER];
  1007.           int i;
  1008.  
  1009.           for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
  1010.         reg_map[i] = 0;
  1011.  
  1012.           reg_map[REGNO (operands[0])] = gen_rtx (REG, Pmode, 0);
  1013.           operands[1] = copy_rtx (operands[1]);
  1014.           replace_regs (operands[1], reg_map, FIRST_PSEUDO_REGISTER, 0);
  1015.           return \"exg %/d0,%0\;move%.b %1,%/d0\;exg %/d0,%0\";
  1016.         }
  1017.     }
  1018.  
  1019.       /* If the address of operand 1 uses d0, choose d1 as intermediate.  */
  1020.       if (refers_to_regno_p (0, 1, operands[1], NULL_RTX))
  1021.     return \"exg %/d1,%0\;move%.b %1,%/d1\;exg %/d1,%0\";
  1022.       /* Otherwise d0 is usable.
  1023.      (An effective address on the 68k can't use two d-regs.)  */
  1024.       else
  1025.     return \"exg %/d0,%0\;move%.b %1,%/d0\;exg %/d0,%0\";
  1026.     }
  1027.     
  1028.   /* Likewise for moving from an address reg.  */
  1029.   if (ADDRESS_REG_P (operands[1]) && GET_CODE (operands[0]) == MEM)
  1030.     {
  1031.       /* ??? For 2.5, don't allow this choice and use secondary reloads
  1032.      instead.
  1033.  
  1034.      See if the address register is used in the address.  If it
  1035.      is, we have to generate a more complex sequence than those below.  */
  1036.       if (refers_to_regno_p (REGNO (operands[1]), REGNO (operands[1]) + 1,
  1037.                  operands[0], NULL_RTX))
  1038.     {
  1039.       /* See if the stack pointer is used in the address.  If it isn't,
  1040.          we can push d0 or d1 (the insn can't use both of them) on
  1041.          the stack, copy the byte to d0/1, perform our move from d0/d1, 
  1042.          and pop d0/1.  */
  1043.       if (! reg_mentioned_p (stack_pointer_rtx, operands[0]))
  1044.         {
  1045.           if (! refers_to_regno_p (0, 1, operands[0], NULL_RTX))
  1046.         return \"move%.l %/d0,%-\;move%.l %1,%/d0\;move%.b %/d0,%0\;move%.l %+,%/d0\";
  1047.           else
  1048.         return \"move%.l %/d1,%-\;move%.l %1,%/d1\;move%.b %/d1,%0\;move%.l %+,%/d1\";
  1049.         }
  1050.       else
  1051.         {
  1052.           /* Otherwise, we know that d0 cannot be used in the address
  1053.          (since sp and one address register is).  Assume that sp is
  1054.          being used as a base register and replace the address
  1055.          register that is our operand[1] with d0.  */
  1056.           rtx reg_map[FIRST_PSEUDO_REGISTER];
  1057.           int i;
  1058.  
  1059.           for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
  1060.         reg_map[i] = 0;
  1061.  
  1062.           reg_map[REGNO (operands[1])] = gen_rtx (REG, Pmode, 0);
  1063.           operands[0] = copy_rtx (operands[0]);
  1064.           replace_regs (operands[0], reg_map, FIRST_PSEUDO_REGISTER, 0);
  1065.           return \"exg %/d0,%1\;move%.b %/d0,%0\;exg %/d0,%1\";
  1066.         }
  1067.     }
  1068.  
  1069.       if (refers_to_regno_p (0, 1, operands[0], NULL_RTX))
  1070.         return \"exg %/d1,%1\;move%.b %/d1,%0\;exg %/d1,%1\";
  1071.       else
  1072.         return \"exg %/d0,%1\;move%.b %/d0,%0\;exg %/d0,%1\";
  1073.     }
  1074.  
  1075.   /* clr and st insns on 68000 read before writing.
  1076.      This isn't so on the 68010, but we have no alternative for it.  */
  1077.   if (TARGET_68020
  1078.       || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))
  1079.     {
  1080.       if (operands[1] == const0_rtx)
  1081.     return \"clr%.b %0\";
  1082.       if (GET_CODE (operands[1]) == CONST_INT
  1083.       && INTVAL (operands[1]) == -1)
  1084.     {
  1085.       CC_STATUS_INIT;
  1086.       return \"st %0\";
  1087.     }
  1088.     }
  1089.   if (GET_CODE (operands[1]) != CONST_INT && CONSTANT_P (operands[1]))
  1090.     return \"move%.l %1,%0\";
  1091.   if (ADDRESS_REG_P (operands[0]) || ADDRESS_REG_P (operands[1]))
  1092.     return \"move%.w %1,%0\";
  1093.   return \"move%.b %1,%0\";
  1094. }")
  1095.  
  1096. (define_insn "movstrictqi"
  1097.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  1098.     (match_operand:QI 1 "general_operand" "dmn"))]
  1099.   ""
  1100.   "*
  1101. {
  1102.   if (operands[1] == const0_rtx
  1103.       /* clr insns on 68000 read before writing.
  1104.          This isn't so on the 68010, but we have no alternative for it.  */
  1105.       && (TARGET_68020
  1106.           || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
  1107.     return \"clr%.b %0\";
  1108.   return \"move%.b %1,%0\";
  1109. }")
  1110.  
  1111. (define_insn "movsf"
  1112.   [(set (match_operand:SF 0 "general_operand" "=rmf,x,y,rm,!x,!rm")
  1113.     (match_operand:SF 1 "general_operand" "rmfF,xH,rmF,y,rm,x"))]
  1114. ;  [(set (match_operand:SF 0 "general_operand" "=rmf")
  1115. ;    (match_operand:SF 1 "general_operand" "rmfF"))]
  1116.   ""
  1117.   "*
  1118. {
  1119.   if (which_alternative >= 4)
  1120.     return \"fpmove%.s %1,fpa0\;fpmove%.s fpa0,%0\";
  1121.   if (FPA_REG_P (operands[0]))
  1122.     {
  1123.       if (FPA_REG_P (operands[1]))
  1124.     return \"fpmove%.s %x1,%x0\";
  1125.       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1126.     return output_move_const_single (operands);
  1127.       else if (FP_REG_P (operands[1]))
  1128.         return \"fmove%.s %1,sp@-\;fpmove%.d sp@+, %0\";
  1129.       return \"fpmove%.s %x1,%x0\";
  1130.     }
  1131.   if (FPA_REG_P (operands[1]))
  1132.     {
  1133.       if (FP_REG_P (operands[0]))
  1134.     return \"fpmove%.s %x1,sp@-\;fmove%.s sp@+,%0\";
  1135.       else
  1136.     return \"fpmove%.s %x1,%x0\";
  1137.     }
  1138.   if (FP_REG_P (operands[0]))
  1139.     {
  1140.       if (FP_REG_P (operands[1]))
  1141.     return \"f%$move%.x %1,%0\";
  1142.       else if (ADDRESS_REG_P (operands[1]))
  1143.     return \"move%.l %1,%-\;f%$move%.s %+,%0\";
  1144.       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1145.     return output_move_const_single (operands);
  1146.       return \"f%$move%.s %f1,%0\";
  1147.     }
  1148.   if (FP_REG_P (operands[1]))
  1149.     {
  1150.       if (ADDRESS_REG_P (operands[0]))
  1151.     return \"fmove%.s %1,%-\;move%.l %+,%0\";
  1152.       return \"fmove%.s %f1,%0\";
  1153.     }
  1154.   return \"move%.l %1,%0\";
  1155. }")
  1156.  
  1157. (define_insn "movdf"
  1158.   [(set (match_operand:DF 0 "general_operand" "=rm,rf,rf,&rof<>,y,rm,x,!x,!rm")
  1159.     (match_operand:DF 1 "general_operand" "rf,m,0,rofE<>,rmE,y,xH,rm,x"))]
  1160. ;  [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&rof<>")
  1161. ;    (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
  1162.   ""
  1163.   "*
  1164. {
  1165.   if (which_alternative == 7)
  1166.     return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
  1167.   if (FPA_REG_P (operands[0]))
  1168.     {
  1169.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1170.     return output_move_const_double (operands);
  1171.       if (FP_REG_P (operands[1]))
  1172.         return \"fmove%.d %1,sp@-\;fpmove%.d sp@+,%x0\";
  1173.       return \"fpmove%.d %x1,%x0\";
  1174.     }
  1175.   else if (FPA_REG_P (operands[1]))
  1176.     {
  1177.       if (FP_REG_P(operands[0]))
  1178.         return \"fpmove%.d %x1,sp@-\;fmoved sp@+,%0\";
  1179.       else
  1180.         return \"fpmove%.d %x1,%x0\";
  1181.     }
  1182.   if (FP_REG_P (operands[0]))
  1183.     {
  1184.       if (FP_REG_P (operands[1]))
  1185.     return \"f%&move%.x %1,%0\";
  1186.       if (REG_P (operands[1]))
  1187.     {
  1188.       rtx xoperands[2];
  1189.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  1190.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1191.       output_asm_insn (\"move%.l %1,%-\", operands);
  1192.       return \"f%&move%.d %+,%0\";
  1193.     }
  1194.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1195.     return output_move_const_double (operands);
  1196.       return \"f%&move%.d %f1,%0\";
  1197.     }
  1198.   else if (FP_REG_P (operands[1]))
  1199.     {
  1200.       if (REG_P (operands[0]))
  1201.     {
  1202.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1203.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1204.       return \"move%.l %+,%0\";
  1205.     }
  1206.       else
  1207.         return \"fmove%.d %f1,%0\";
  1208.     }
  1209.   return output_move_double (operands);
  1210. }
  1211. ")
  1212.  
  1213. (define_expand "movxf"
  1214.   [(set (match_operand:XF 0 "nonimmediate_operand" "")
  1215.     (match_operand:XF 1 "general_operand" ""))]
  1216.   ""
  1217.   "
  1218. {
  1219.   if (CONSTANT_P (operands[1]))
  1220.     {
  1221.       operands[1] = force_const_mem (XFmode, operands[1]);
  1222.       if (! memory_address_p (XFmode, XEXP (operands[1], 0))
  1223.       && ! reload_in_progress)
  1224.     operands[1] = change_address (operands[1], XFmode,
  1225.                       XEXP (operands[1], 0));
  1226.     }
  1227. }")
  1228.  
  1229. (define_insn ""
  1230.   [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f")
  1231.     (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r"))]
  1232.   "TARGET_68881"
  1233.   "*
  1234. {
  1235.   if (FP_REG_P (operands[0]))
  1236.     {
  1237.       if (FP_REG_P (operands[1]))
  1238.     return \"fmove%.x %1,%0\";
  1239.       if (REG_P (operands[1]))
  1240.     {
  1241.       rtx xoperands[2];
  1242.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
  1243.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1244.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  1245.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1246.       output_asm_insn (\"move%.l %1,%-\", operands);
  1247.       return \"fmove%.x %+,%0\";
  1248.     }
  1249.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1250.         return \"fmove%.x %1,%0\";
  1251.       return \"fmove%.x %f1,%0\";
  1252.     }
  1253.   if (REG_P (operands[0]))
  1254.     {
  1255.       output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
  1256.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1257.       output_asm_insn (\"move%.l %+,%0\", operands);
  1258.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1259.       return \"move%.l %+,%0\";
  1260.     }
  1261.   return \"fmove%.x %f1,%0\";
  1262. }
  1263. ")
  1264.  
  1265. (define_insn ""
  1266.   [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
  1267.     (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
  1268.   "! TARGET_68881"
  1269.   "*
  1270. {
  1271.   if (FP_REG_P (operands[0]))
  1272.     {
  1273.       if (FP_REG_P (operands[1]))
  1274.     return \"fmove%.x %1,%0\";
  1275.       if (REG_P (operands[1]))
  1276.     {
  1277.       rtx xoperands[2];
  1278.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
  1279.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1280.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  1281.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1282.       output_asm_insn (\"move%.l %1,%-\", operands);
  1283.       return \"fmove%.x %+,%0\";
  1284.     }
  1285.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1286.         return \"fmove%.x %1,%0\";
  1287.       return \"fmove%.x %f1,%0\";
  1288.     }
  1289.   if (FP_REG_P (operands[1]))
  1290.     {
  1291.       if (REG_P (operands[0]))
  1292.         {
  1293.           output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
  1294.           operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1295.           output_asm_insn (\"move%.l %+,%0\", operands);
  1296.           operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1297.           return \"move%.l %+,%0\";
  1298.         }
  1299.       else
  1300.         return \"fmove%.x %f1,%0\";
  1301.     }
  1302.   return output_move_double (operands);
  1303. }
  1304. ")
  1305.  
  1306. ;; movdi can apply to fp regs in some cases
  1307. (define_insn "movdi"
  1308.   ;; Let's see if it really still needs to handle fp regs, and, if so, why.
  1309.   [(set (match_operand:DI 0 "general_operand" "=rm,r,&ro<>,y,rm,!*x,!rm")
  1310.     (match_operand:DI 1 "general_operand" "rF,m,roi<>F,rmiF,y,rmF,*x"))]
  1311. ;  [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>,!&rm,!&f,y,rm,x,!x,!rm")
  1312. ;    (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfmF,rmi,y,rm,x"))]
  1313. ;  [(set (match_operand:DI 0 "general_operand" "=rm,&rf,&ro<>,!&rm,!&f")
  1314. ;    (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
  1315.   ""
  1316.   "*
  1317. {
  1318.   if (which_alternative == 8)
  1319.     return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
  1320.   if (FPA_REG_P (operands[0]) || FPA_REG_P (operands[1]))
  1321.     return \"fpmove%.d %x1,%x0\";
  1322.   if (FP_REG_P (operands[0]))
  1323.     {
  1324.       if (FP_REG_P (operands[1]))
  1325.     return \"fmove%.x %1,%0\";
  1326.       if (REG_P (operands[1]))
  1327.     {
  1328.       rtx xoperands[2];
  1329.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  1330.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1331.       output_asm_insn (\"move%.l %1,%-\", operands);
  1332.       return \"fmove%.d %+,%0\";
  1333.     }
  1334.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1335.     return output_move_const_double (operands);
  1336.       return \"fmove%.d %f1,%0\";
  1337.     }
  1338.   else if (FP_REG_P (operands[1]))
  1339.     {
  1340.       if (REG_P (operands[0]))
  1341.     {
  1342.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1343.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1344.       return \"move%.l %+,%0\";
  1345.     }
  1346.       else
  1347.         return \"fmove%.d %f1,%0\";
  1348.     }
  1349.   return output_move_double (operands);
  1350. }
  1351. ")
  1352.  
  1353. ;; Thus goes after the move instructions
  1354. ;; because the move instructions are better (require no spilling)
  1355. ;; when they can apply.  It goes before the add/sub insns
  1356. ;; so we will prefer it to them.
  1357.  
  1358. (define_insn "pushasi"
  1359.   [(set (match_operand:SI 0 "push_operand" "=m")
  1360.     (match_operand:SI 1 "address_operand" "p"))]
  1361.   ""
  1362.   "pea %a1")
  1363.  
  1364. ;; truncation instructions
  1365. (define_insn "truncsiqi2"
  1366.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  1367.     (truncate:QI
  1368.      (match_operand:SI 1 "general_operand" "doJ,i")))]
  1369.   ""
  1370.   "*
  1371. {
  1372.   if (GET_CODE (operands[0]) == REG)
  1373.     {
  1374.       /* Must clear condition codes, since the move.l bases them on
  1375.      the entire 32 bits, not just the desired 8 bits.  */
  1376.       CC_STATUS_INIT;
  1377.       return \"move%.l %1,%0\";
  1378.     }
  1379.   if (GET_CODE (operands[1]) == MEM)
  1380.     operands[1] = adj_offsettable_operand (operands[1], 3);
  1381.   return \"move%.b %1,%0\";
  1382. }")
  1383.  
  1384. (define_insn "trunchiqi2"
  1385.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  1386.     (truncate:QI
  1387.      (match_operand:HI 1 "general_operand" "doJ,i")))]
  1388.   ""
  1389.   "*
  1390. {
  1391.   if (GET_CODE (operands[0]) == REG
  1392.       && (GET_CODE (operands[1]) == MEM
  1393.       || GET_CODE (operands[1]) == CONST_INT))
  1394.     {
  1395.       /* Must clear condition codes, since the move.w bases them on
  1396.      the entire 16 bits, not just the desired 8 bits.  */
  1397.       CC_STATUS_INIT;
  1398.       return \"move%.w %1,%0\";
  1399.     }
  1400.   if (GET_CODE (operands[0]) == REG)
  1401.     {
  1402.       /* Must clear condition codes, since the move.l bases them on
  1403.      the entire 32 bits, not just the desired 8 bits.  */
  1404.       CC_STATUS_INIT;
  1405.       return \"move%.l %1,%0\";
  1406.     }
  1407.   if (GET_CODE (operands[1]) == MEM)
  1408.     operands[1] = adj_offsettable_operand (operands[1], 1);
  1409.   return \"move%.b %1,%0\";
  1410. }")
  1411.  
  1412. (define_insn "truncsihi2"
  1413.   [(set (match_operand:HI 0 "general_operand" "=dm,d")
  1414.     (truncate:HI
  1415.      (match_operand:SI 1 "general_operand" "roJ,i")))]
  1416.   ""
  1417.   "*
  1418. {
  1419.   if (GET_CODE (operands[0]) == REG)
  1420.     {
  1421.       /* Must clear condition codes, since the move.l bases them on
  1422.      the entire 32 bits, not just the desired 8 bits.  */
  1423.       CC_STATUS_INIT;
  1424.       return \"move%.l %1,%0\";
  1425.     }
  1426.   if (GET_CODE (operands[1]) == MEM)
  1427.     operands[1] = adj_offsettable_operand (operands[1], 2);
  1428.   return \"move%.w %1,%0\";
  1429. }")
  1430.  
  1431. ;; zero extension instructions
  1432.  
  1433. ;; this is the canonical form for (lshiftrt:DI x 32)
  1434. (define_insn "zero_extendsidi2"
  1435.   [(set (match_operand:DI 0 "general_operand" "ro,<,>")
  1436.     (zero_extend:DI (match_operand:SI 1 "general_operand" "rm,rm,rm")))]
  1437.   ""
  1438.   "*
  1439. {
  1440.   CC_STATUS_INIT;
  1441.   if (which_alternative == 2)
  1442.     return \"clr%.l %0\;move%.l %1,%0\";
  1443.   if (which_alternative == 1)
  1444.     return \"move%.l %1,%0\;clr%.l %0\";
  1445.   if (GET_CODE (operands[0]) == REG)
  1446.     operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1447.   else
  1448.     operands[2] = adj_offsettable_operand (operands[0], 4);
  1449.   if (ADDRESS_REG_P (operands[0]))
  1450.     return \"move%.l %1,%2\;sub%.l %0,%0\";
  1451.   else
  1452.     return \"move%.l %1,%2\;clr%.l %0\";
  1453. }")
  1454.  
  1455. (define_expand "zero_extendhisi2"
  1456.   [(set (match_operand:SI 0 "register_operand" "")
  1457.     (const_int 0))
  1458.    (set (strict_low_part (match_dup 2))
  1459.     (match_operand:HI 1 "general_operand" ""))]
  1460.   ""
  1461.   "
  1462. {
  1463.   operands[1] = make_safe_from (operands[1], operands[0]);
  1464.   if (GET_CODE (operands[0]) == SUBREG)
  1465.     operands[2] = gen_rtx (SUBREG, HImode, SUBREG_REG (operands[0]),
  1466.                SUBREG_WORD (operands[0]));
  1467.   else
  1468.     operands[2] = gen_rtx (SUBREG, HImode, operands[0], 0);
  1469. }")
  1470.  
  1471. (define_expand "zero_extendqihi2"
  1472.   [(set (match_operand:HI 0 "register_operand" "")
  1473.     (const_int 0))
  1474.    (set (strict_low_part (match_dup 2))
  1475.     (match_operand:QI 1 "general_operand" ""))]
  1476.   ""
  1477.   "
  1478. {
  1479.   operands[1] = make_safe_from (operands[1], operands[0]);
  1480.   if (GET_CODE (operands[0]) == SUBREG)
  1481.     operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
  1482.                SUBREG_WORD (operands[0]));
  1483.   else
  1484.     operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
  1485. }")
  1486.  
  1487. (define_expand "zero_extendqisi2"
  1488.   [(set (match_operand:SI 0 "register_operand" "")
  1489.     (const_int 0))
  1490.    (set (strict_low_part (match_dup 2))
  1491.     (match_operand:QI 1 "general_operand" ""))]
  1492.   ""
  1493.   "
  1494. {
  1495.   operands[1] = make_safe_from (operands[1], operands[0]);
  1496.   if (GET_CODE (operands[0]) == SUBREG)
  1497.     operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
  1498.                SUBREG_WORD (operands[0]));
  1499.   else
  1500.     operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
  1501. }")
  1502.  
  1503. ;; Patterns to recognize zero-extend insns produced by the combiner.
  1504. ;; We don't allow both operands in memory, because of aliasing problems.
  1505. ;; Explicitly disallow two memory operands via the condition since reloading
  1506. ;; of this case will result in worse code than the uncombined patterns.
  1507.  
  1508. (define_insn ""
  1509.   [(set (match_operand:SI 0 "general_operand" "=do<>,d<")
  1510.     (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
  1511.   "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
  1512.   "*
  1513. {
  1514.   if (DATA_REG_P (operands[0]))
  1515.     {
  1516.       if (GET_CODE (operands[1]) == REG
  1517.       && REGNO (operands[0]) == REGNO (operands[1]))
  1518.     return \"and%.l %#0xFFFF,%0\";
  1519.       if (reg_mentioned_p (operands[0], operands[1]))
  1520.         return \"move%.w %1,%0\;and%.l %#0xFFFF,%0\";
  1521.       return \"clr%.l %0\;move%.w %1,%0\";
  1522.     }
  1523.   else if (GET_CODE (operands[0]) == MEM
  1524.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1525.     return \"move%.w %1,%0\;clr%.w %0\";
  1526.   else if (GET_CODE (operands[0]) == MEM
  1527.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1528.     return \"clr%.w %0\;move%.w %1,%0\";
  1529.   else
  1530.     {
  1531.       output_asm_insn (\"clr%.w %0\", operands);
  1532.       operands[0] = adj_offsettable_operand (operands[0], 2);
  1533.       return \"move%.w %1,%0\";
  1534.     }
  1535. }")
  1536.  
  1537. (define_insn ""
  1538.   [(set (match_operand:HI 0 "general_operand" "=do<>,d")
  1539.     (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
  1540.   "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
  1541.   "*
  1542. {
  1543.   if (DATA_REG_P (operands[0]))
  1544.     {
  1545.       if (GET_CODE (operands[1]) == REG
  1546.       && REGNO (operands[0]) == REGNO (operands[1]))
  1547.     return \"and%.w %#0xFF,%0\";
  1548.       if (reg_mentioned_p (operands[0], operands[1]))
  1549.         return \"move%.b %1,%0\;and%.w %#0xFF,%0\";
  1550.       return \"clr%.w %0\;move%.b %1,%0\";
  1551.     }
  1552.   else if (GET_CODE (operands[0]) == MEM
  1553.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1554.     {
  1555.       if (REGNO (XEXP (XEXP (operands[0], 0), 0))
  1556.       == STACK_POINTER_REGNUM)
  1557.     {
  1558.       output_asm_insn (\"clr%.w %-\", operands);
  1559.       operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  1560.                  plus_constant (stack_pointer_rtx, 1));
  1561.       return \"move%.b %1,%0\";
  1562.     }
  1563.       else
  1564.     return \"move%.b %1,%0\;clr%.b %0\";
  1565.     }
  1566.   else if (GET_CODE (operands[0]) == MEM
  1567.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1568.     return \"clr%.b %0\;move%.b %1,%0\";
  1569.   else
  1570.     {
  1571.       output_asm_insn (\"clr%.b %0\", operands);
  1572.       operands[0] = adj_offsettable_operand (operands[0], 1);
  1573.       return \"move%.b %1,%0\";
  1574.     }
  1575. }")
  1576.  
  1577. (define_insn ""
  1578.   [(set (match_operand:SI 0 "general_operand" "=do<>,d")
  1579.     (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
  1580.   "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
  1581.   "*
  1582. {
  1583.   if (DATA_REG_P (operands[0]))
  1584.     {
  1585.       if (GET_CODE (operands[1]) == REG
  1586.       && REGNO (operands[0]) == REGNO (operands[1]))
  1587.     return \"and%.l %#0xFF,%0\";
  1588.       if (reg_mentioned_p (operands[0], operands[1]))
  1589.         return \"move%.b %1,%0\;and%.l %#0xFF,%0\";
  1590.       return \"clr%.l %0\;move%.b %1,%0\";
  1591.     }
  1592.   else if (GET_CODE (operands[0]) == MEM
  1593.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1594.     {
  1595.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  1596. #ifdef MOTOROLA
  1597. #ifdef SGS
  1598.       return \"clr%.l -(%0)\;move%.b %1,3(%0)\";
  1599. #else
  1600.       return \"clr%.l -(%0)\;move%.b %1,(3,%0)\";
  1601. #endif
  1602. #else
  1603.       return \"clrl %0@-\;moveb %1,%0@(3)\";
  1604. #endif
  1605.     }
  1606.   else if (GET_CODE (operands[0]) == MEM
  1607.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1608.     {
  1609.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  1610. #ifdef MOTOROLA
  1611. #ifdef SGS
  1612.       return \"clr%.l (%0)+\;move%.b %1,-1(%0)\";
  1613. #else
  1614.       return \"clr%.l (%0)+\;move%.b %1,(-1,%0)\";
  1615. #endif
  1616. #else
  1617.       return \"clrl %0@+\;moveb %1,%0@(-1)\";
  1618. #endif
  1619.     }
  1620.   else
  1621.     {
  1622.       output_asm_insn (\"clr%.l %0\", operands);
  1623.       operands[0] = adj_offsettable_operand (operands[0], 3);
  1624.       return \"move%.b %1,%0\";
  1625.     }
  1626. }")
  1627.  
  1628. ;; sign extension instructions
  1629.  
  1630. (define_insn "extendqidi2"
  1631.   [(set (match_operand:DI 0 "general_operand" "=d")
  1632.     (sign_extend:DI
  1633.      (match_operand:QI 1 "general_operand" "rm")))]
  1634.   ""
  1635.   "*
  1636. {
  1637.   CC_STATUS_INIT;
  1638.   operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1639.   if (TARGET_68020)
  1640.     return \"move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0\";
  1641.   else
  1642.     return \"move%.b %1,%2\;ext%.w %0\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0\";
  1643. }")
  1644.  
  1645. (define_insn "extendhidi2"
  1646.   [(set (match_operand:DI 0 "general_operand" "=d")
  1647.     (sign_extend:DI
  1648.      (match_operand:HI 1 "general_operand" "rm")))]
  1649.   ""
  1650.   "*
  1651. {
  1652.   CC_STATUS_INIT;
  1653.   operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1654.   if (TARGET_68020)
  1655.     return \"move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0\";
  1656.   else
  1657.     return \"move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0\";
  1658. }")
  1659.  
  1660. (define_insn "extendsidi2"
  1661.   [(set (match_operand:DI 0 "general_operand" "=d")
  1662.     (sign_extend:DI
  1663.      (match_operand:SI 1 "general_operand" "rm")))]
  1664.   ""
  1665.   "*
  1666. {
  1667.   CC_STATUS_INIT;
  1668.   operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1669.   if (TARGET_68020)
  1670.     return \"move%.l %1,%2\;smi %0\;extb%.l %0\";
  1671.   else
  1672.     return \"move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0\";
  1673. }")
  1674.  
  1675. ;; Special case when one can avoid register clobbering, copy and test
  1676. ;; Maybe there is a way to make that the general case, by forcing the
  1677. ;; result of the SI tree to be in the lower register of the DI target
  1678.  
  1679. (define_insn "extendplussidi"
  1680.   [(set (match_operand:DI 0 "register_operand" "=d")
  1681.     (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
  1682.             (match_operand:SI 2 "general_operand" "rmn"))))]
  1683.   ""
  1684.   "*
  1685. {
  1686.   CC_STATUS_INIT;
  1687.   operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1688.   if (GET_CODE (operands[1]) == CONST_INT
  1689.   && (unsigned) INTVAL (operands[1]) > 8)
  1690.     {
  1691.       rtx tmp = operands[1];
  1692.  
  1693.       operands[1] = operands[2];
  1694.       operands[2] = tmp;
  1695.     }
  1696.   if (TARGET_68020)
  1697.     return \"move%.l %2,%3\;add%.l %1,%3\;smi %0\;extb%.l %0\";
  1698.   else
  1699.     return \"move%.l %2,%3\;add%.l %1,%3\;smi %0\;ext%.w %0\;ext%.l %0\";
  1700. }")
  1701.  
  1702. (define_insn "extendhisi2"
  1703.   [(set (match_operand:SI 0 "general_operand" "=*d,a")
  1704.     (sign_extend:SI
  1705.      (match_operand:HI 1 "nonimmediate_operand" "0,rm")))]
  1706.   ""
  1707.   "*
  1708. {
  1709.   if (ADDRESS_REG_P (operands[0]))
  1710.     return \"move%.w %1,%0\";
  1711.   return \"ext%.l %0\";
  1712. }")
  1713.  
  1714. (define_insn "extendqihi2"
  1715.   [(set (match_operand:HI 0 "general_operand" "=d")
  1716.     (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
  1717.   ""
  1718.   "ext%.w %0")
  1719.  
  1720. (define_insn "extendqisi2"
  1721.   [(set (match_operand:SI 0 "general_operand" "=d")
  1722.     (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
  1723.   "TARGET_68020"
  1724.   "extb%.l %0")
  1725.  
  1726. ;; Conversions between float and double.
  1727.  
  1728. (define_expand "extendsfdf2"
  1729.   [(set (match_operand:DF 0 "general_operand" "")
  1730.     (float_extend:DF
  1731.      (match_operand:SF 1 "general_operand" "")))]
  1732.   "TARGET_68881 || TARGET_FPA"
  1733.   "")
  1734.  
  1735. (define_insn ""
  1736.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  1737.     (float_extend:DF
  1738.      (match_operand:SF 1 "general_operand" "xH,rmF")))]
  1739.   "TARGET_FPA"
  1740.   "fpstod %w1,%0")
  1741.  
  1742. (define_insn ""
  1743.   [(set (match_operand:DF 0 "general_operand" "=*fdm,f")
  1744.     (float_extend:DF
  1745.       (match_operand:SF 1 "general_operand" "f,dmF")))]
  1746.   "TARGET_68881"
  1747.   "*
  1748. {
  1749.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1750.     {
  1751.       if (REGNO (operands[0]) == REGNO (operands[1]))
  1752.     {
  1753.       /* Extending float to double in an fp-reg is a no-op.
  1754.          NOTICE_UPDATE_CC has already assumed that the
  1755.          cc will be set.  So cancel what it did.  */
  1756.       cc_status = cc_prev_status;
  1757.       return \"\";
  1758.     }
  1759.       return \"f%&move%.x %1,%0\";
  1760.     }
  1761.   if (FP_REG_P (operands[0]))
  1762.     return \"f%&move%.s %f1,%0\";
  1763.   if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1764.     {
  1765.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1766.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1767.       return \"move%.l %+,%0\";
  1768.     }
  1769.   return \"fmove%.d %f1,%0\";
  1770. }")
  1771.  
  1772. ;; This cannot output into an f-reg because there is no way to be
  1773. ;; sure of truncating in that case.
  1774. ;; But on the Sun FPA, we can be sure.
  1775. (define_expand "truncdfsf2"
  1776.   [(set (match_operand:SF 0 "general_operand" "")
  1777.     (float_truncate:SF
  1778.       (match_operand:DF 1 "general_operand" "")))]
  1779.   "TARGET_68881 || TARGET_FPA"
  1780.   "")
  1781.  
  1782. (define_insn ""
  1783.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  1784.     (float_truncate:SF
  1785.       (match_operand:DF 1 "general_operand" "xH,rmF")))]
  1786.   "TARGET_FPA"
  1787.   "fpdtos %y1,%0")
  1788.  
  1789. ;; On the '040 we can truncate in a register accurately and easily.
  1790. (define_insn ""
  1791.   [(set (match_operand:SF 0 "general_operand" "=f")
  1792.     (float_truncate:SF
  1793.       (match_operand:DF 1 "general_operand" "fmG")))]
  1794.   "TARGET_68040_ONLY"
  1795.   "*
  1796. {
  1797.   if (FP_REG_P (operands[1]))
  1798.     return \"f%$move%.x %1,%0\";
  1799.   return \"f%$move%.d %f1,%0\";
  1800. }")
  1801.  
  1802. (define_insn ""
  1803.   [(set (match_operand:SF 0 "general_operand" "=dm")
  1804.     (float_truncate:SF
  1805.       (match_operand:DF 1 "general_operand" "f")))]
  1806.   "TARGET_68881"
  1807.   "fmove%.s %f1,%0")
  1808.  
  1809. ;; Conversion between fixed point and floating point.
  1810. ;; Note that among the fix-to-float insns
  1811. ;; the ones that start with SImode come first.
  1812. ;; That is so that an operand that is a CONST_INT
  1813. ;; (and therefore lacks a specific machine mode).
  1814. ;; will be recognized as SImode (which is always valid)
  1815. ;; rather than as QImode or HImode.
  1816.  
  1817. (define_expand "floatsisf2"
  1818.   [(set (match_operand:SF 0 "general_operand" "")
  1819.     (float:SF (match_operand:SI 1 "general_operand" "")))]
  1820.   "TARGET_68881 || TARGET_FPA"
  1821.   "")
  1822.  
  1823. (define_insn ""
  1824.   [(set (match_operand:SF 0 "general_operand" "=y,x")
  1825.     (float:SF (match_operand:SI 1 "general_operand" "rmi,x")))]
  1826.   "TARGET_FPA"
  1827.   "fpltos %1,%0")
  1828.  
  1829. (define_insn ""
  1830.   [(set (match_operand:SF 0 "general_operand" "=f")
  1831.     (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
  1832.   "TARGET_68881"
  1833.   "f%$move%.l %1,%0")
  1834.  
  1835. (define_expand "floatsidf2"
  1836.   [(set (match_operand:DF 0 "general_operand" "")
  1837.     (float:DF (match_operand:SI 1 "general_operand" "")))]
  1838.   "TARGET_68881 || TARGET_FPA"
  1839.   "")
  1840.  
  1841. (define_insn ""
  1842.   [(set (match_operand:DF 0 "general_operand" "=y,x")
  1843.     (float:DF (match_operand:SI 1 "general_operand" "rmi,x")))]
  1844.   "TARGET_FPA"
  1845.   "fpltod %1,%0")
  1846.  
  1847. (define_insn ""
  1848.   [(set (match_operand:DF 0 "general_operand" "=f")
  1849.     (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
  1850.   "TARGET_68881"
  1851.   "f%&move%.l %1,%0")
  1852.  
  1853. (define_insn "floathisf2"
  1854.   [(set (match_operand:SF 0 "general_operand" "=f")
  1855.     (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
  1856.   "TARGET_68881"
  1857.   "f%$move%.w %1,%0")
  1858.  
  1859. (define_insn "floathidf2"
  1860.   [(set (match_operand:DF 0 "general_operand" "=f")
  1861.     (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
  1862.   "TARGET_68881"
  1863.   "fmove%.w %1,%0")
  1864.  
  1865. (define_insn "floatqisf2"
  1866.   [(set (match_operand:SF 0 "general_operand" "=f")
  1867.     (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
  1868.   "TARGET_68881"
  1869.   "fmove%.b %1,%0")
  1870.  
  1871. (define_insn "floatqidf2"
  1872.   [(set (match_operand:DF 0 "general_operand" "=f")
  1873.     (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
  1874.   "TARGET_68881"
  1875.   "f%&move%.b %1,%0")
  1876.  
  1877. ;; New routines to convert floating-point values to integers
  1878. ;; to be used on the '040.  These should be faster than trapping
  1879. ;; into the kernel to emulate fintrz.  They should also be faster
  1880. ;; than calling the subroutines fixsfsi or fixdfsi.
  1881.  
  1882. (define_insn "fix_truncdfsi2"
  1883.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1884.     (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
  1885.    (clobber (match_scratch:SI 2 "=d"))
  1886.    (clobber (match_scratch:SI 3 "=d"))]
  1887.   "TARGET_68881 && TARGET_68040"
  1888.   "*
  1889. {
  1890.   CC_STATUS_INIT;
  1891.   return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.l %1,%0\;fmovem%.l %2,%!\";
  1892. }")
  1893.  
  1894. (define_insn "fix_truncdfhi2"
  1895.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1896.     (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
  1897.    (clobber (match_scratch:SI 2 "=d"))
  1898.    (clobber (match_scratch:SI 3 "=d"))]
  1899.   "TARGET_68881 && TARGET_68040"
  1900.   "*
  1901. {
  1902.   CC_STATUS_INIT;
  1903.   return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.w %1,%0\;fmovem%.l %2,%!\";
  1904. }")
  1905.  
  1906. (define_insn "fix_truncdfqi2"
  1907.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1908.     (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
  1909.    (clobber (match_scratch:SI 2 "=d"))
  1910.    (clobber (match_scratch:SI 3 "=d"))]
  1911.   "TARGET_68881 && TARGET_68040"
  1912.   "*
  1913. {
  1914.   CC_STATUS_INIT;
  1915.   return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.b %1,%0\;fmovem%.l %2,%!\";
  1916. }")
  1917.  
  1918. ;; Convert a float to a float whose value is an integer.
  1919. ;; This is the first stage of converting it to an integer type.
  1920.  
  1921. (define_insn "ftruncdf2"
  1922.   [(set (match_operand:DF 0 "general_operand" "=f")
  1923.     (fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
  1924.   "TARGET_68881 && !TARGET_68040"
  1925.   "*
  1926. {
  1927.   if (FP_REG_P (operands[1]))
  1928.     return \"fintrz%.x %f1,%0\";
  1929.   return \"fintrz%.d %f1,%0\";
  1930. }")
  1931.  
  1932. (define_insn "ftruncsf2"
  1933.   [(set (match_operand:SF 0 "general_operand" "=f")
  1934.     (fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
  1935.   "TARGET_68881 && !TARGET_68040"
  1936.   "*
  1937. {
  1938.   if (FP_REG_P (operands[1]))
  1939.     return \"fintrz%.x %f1,%0\";
  1940.   return \"fintrz%.s %f1,%0\";
  1941. }")
  1942.  
  1943. ;; Convert a float whose value is an integer
  1944. ;; to an actual integer.  Second stage of converting float to integer type.
  1945. (define_insn "fixsfqi2"
  1946.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1947.     (fix:QI (match_operand:SF 1 "general_operand" "f")))]
  1948.   "TARGET_68881"
  1949.   "fmove%.b %1,%0")
  1950.  
  1951. (define_insn "fixsfhi2"
  1952.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1953.     (fix:HI (match_operand:SF 1 "general_operand" "f")))]
  1954.   "TARGET_68881"
  1955.   "fmove%.w %1,%0")
  1956.  
  1957. (define_insn "fixsfsi2"
  1958.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1959.     (fix:SI (match_operand:SF 1 "general_operand" "f")))]
  1960.   "TARGET_68881"
  1961.   "fmove%.l %1,%0")
  1962.  
  1963. (define_insn "fixdfqi2"
  1964.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1965.     (fix:QI (match_operand:DF 1 "general_operand" "f")))]
  1966.   "TARGET_68881"
  1967.   "fmove%.b %1,%0")
  1968.  
  1969. (define_insn "fixdfhi2"
  1970.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1971.     (fix:HI (match_operand:DF 1 "general_operand" "f")))]
  1972.   "TARGET_68881"
  1973.   "fmove%.w %1,%0")
  1974.  
  1975. (define_insn "fixdfsi2"
  1976.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1977.     (fix:SI (match_operand:DF 1 "general_operand" "f")))]
  1978.   "TARGET_68881"
  1979.   "fmove%.l %1,%0")
  1980.  
  1981. ;; Convert a float to an integer.
  1982. ;; On the Sun FPA, this is done in one step.
  1983.  
  1984. (define_insn ""
  1985.   [(set (match_operand:SI 0 "general_operand" "=x,y")
  1986.     (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "xH,rmF"))))]
  1987.   "TARGET_FPA"
  1988.   "fpstol %w1,%0")
  1989.  
  1990. (define_insn ""
  1991.   [(set (match_operand:SI 0 "general_operand" "=x,y")
  1992.     (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "xH,rmF"))))]
  1993.   "TARGET_FPA"
  1994.   "fpdtol %y1,%0")
  1995.  
  1996. ;; add instructions
  1997.  
  1998. (define_insn "adddia_sexthishl32"
  1999.   [(set (match_operand:DI 0 "register_operand" "+a")
  2000.     (plus:DI (ashift:DI (sign_extend:DI
  2001.           (match_operand:HI 1 "general_operand" "rm"))
  2002.             (const_int 32))
  2003.         (match_dup 0)))]
  2004.   ""
  2005.   "*
  2006. {
  2007.   CC_STATUS_INIT;
  2008.   return \"add%.w %1,%0\";
  2009. } ")
  2010.  
  2011. (define_insn "adddid_sexthishl32"
  2012.   [(set (match_operand:DI 0 "general_operand" "+ro")
  2013.     (plus:DI (ashift:DI (sign_extend:DI
  2014.           (match_operand:HI 1 "general_operand" "rm"))
  2015.             (const_int 32))
  2016.         (match_dup 0)))
  2017.    (clobber (match_scratch:SI 2 "=a"))]
  2018.   ""
  2019.   "*
  2020. {
  2021.   CC_STATUS_INIT;
  2022.   return \"move%.w %1,%2\;add%.l %2,%0\";
  2023. } ")
  2024.  
  2025. (define_insn "adddi_dilshr32"
  2026.   [(set (match_operand:DI 0 "general_operand" "=do")
  2027. ;;    (plus:DI (match_operand:DI 2 "general_operand" "%0")
  2028. ;;    (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
  2029. ;;            (const_int 32))))]
  2030.     (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
  2031.             (const_int 32))
  2032.         (match_operand:DI 2 "general_operand" "0")))]
  2033.   ""
  2034.   "*
  2035. {
  2036.   CC_STATUS_INIT;
  2037.   if (GET_CODE (operands[0]) == REG)
  2038.     operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  2039.   else
  2040.     operands[2] = adj_offsettable_operand (operands[0], 4);
  2041.   return \"add%.l %1,%2\;negx%.l %0\;neg%.l %0\";
  2042. } ")
  2043.  
  2044. (define_insn "adddi_dishl32"
  2045.   [(set (match_operand:DI 0 "general_operand" "=ro")
  2046. ;;    (plus:DI (match_operand:DI 2 "general_operand" "%0")
  2047. ;;    (ashift:DI (match_operand:DI 1 "general_operand" "ro")
  2048. ;;            (const_int 32))))]
  2049.     (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro")
  2050.             (const_int 32))
  2051.         (match_operand:DI 2 "general_operand" "0")))]
  2052.   ""
  2053.   "*
  2054. {
  2055.   CC_STATUS_INIT;
  2056.   if (GET_CODE (operands[1]) == REG)
  2057.     operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  2058.   else
  2059.     operands[1] = adj_offsettable_operand (operands[1], 4);
  2060.   return \"add%.l %1,%0\";
  2061. } ")
  2062.  
  2063. (define_insn "adddi3"
  2064.   [(set (match_operand:DI 0 "general_operand" "=d,<,d,o<>")
  2065.     (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0")
  2066.          (match_operand:DI 2 "general_operand" "d,<,*ao>,d")))
  2067.    (clobber (match_scratch:SI 3 "=X,X,d,d"))]
  2068.   ""
  2069.   "*
  2070. {
  2071.   if (DATA_REG_P (operands[0]))
  2072.     {
  2073.       if (DATA_REG_P (operands[2]))
  2074.     return \"add%.l %R2,%R0\;addx%.l %2,%0\";
  2075.       else if (GET_CODE (operands[2]) == MEM
  2076.       && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
  2077.     {
  2078.       return \"move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0\";
  2079.     }
  2080.       else
  2081.     {
  2082.       /* TODO : this should work also for CONST operands[2] */
  2083.       if (GET_CODE (operands[2]) == REG)
  2084.         operands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
  2085.       else
  2086.         operands[1] = adj_offsettable_operand (operands[2], 4);
  2087.       return \"move%.l %2,%3\;add%.l %1,%R0\;addx%.l %3,%0\";
  2088.     }
  2089.     }
  2090.   else if (GET_CODE (operands[0]) == MEM)
  2091.     {
  2092.       if (GET_CODE (operands[2]) == MEM
  2093.       && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
  2094.     return \"add%.l %2,%0\;addx%.l %2,%0\";
  2095.       CC_STATUS_INIT;
  2096.       if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  2097.     {
  2098.       operands[1] = gen_rtx (MEM, SImode,
  2099.            gen_rtx (PLUS, VOIDmode, XEXP(operands[0], 0),
  2100.                 gen_rtx (CONST_INT, VOIDmode, -8)));
  2101.       return \"move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1\";
  2102.     }
  2103.       else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  2104.     {
  2105.       operands[1] = XEXP(operands[0], 0);
  2106.       return \"add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1\";
  2107.     }
  2108.       else
  2109.     {
  2110.       operands[1] = adj_offsettable_operand (operands[0], 4);
  2111.       return \"add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0\";
  2112.     }
  2113.     }
  2114. } ")
  2115.  
  2116. (define_insn "addsi_lshrsi_31"
  2117.   [(set (match_operand:SI 0 "general_operand" "=dm")
  2118.     (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
  2119.             (const_int 31))
  2120.         (match_dup 1)))]
  2121.   ""
  2122.   "*
  2123. {
  2124.   operands[2] = operands[0];
  2125.   operands[3] = gen_label_rtx();
  2126.   if (GET_CODE (operands[0]) == MEM)
  2127.     {
  2128.       if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  2129.         operands[0] = gen_rtx (MEM, SImode, XEXP (XEXP (operands[0], 0), 0));
  2130.       else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  2131.         operands[2] = gen_rtx (MEM, SImode, XEXP (XEXP (operands[0], 0), 0));
  2132.     }
  2133.   output_asm_insn (\"move%.l %1,%0\", operands);
  2134. #ifdef MOTOROLA
  2135.   output_asm_insn (\"jbpl %l3\", operands);
  2136. #else
  2137.   output_asm_insn (\"jpl %l3\", operands);
  2138. #endif
  2139. #ifndef NO_ADDSUB_Q
  2140.   output_asm_insn (\"addq%.l %#1,%2\", operands);
  2141. #else
  2142.   output_asm_insn (\"add%.l %#1,%2\", operands);
  2143. #endif
  2144.   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
  2145.                 CODE_LABEL_NUMBER (operands[3]));
  2146.   return \"\";
  2147. }")
  2148.  
  2149. ;; Note that the middle two alternatives are near-duplicates
  2150. ;; in order to handle insns generated by reload.
  2151. ;; This is needed since they are not themselves reloaded,
  2152. ;; so commutativity won't apply to them.
  2153. (define_insn "addsi3"
  2154.   [(set (match_operand:SI 0 "general_operand" "=m,?a,?a,r")
  2155.     (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
  2156.          (match_operand:SI 2 "general_operand" "dIKLs,rJK,a,mrIKLs")))]
  2157.   ""
  2158.   "*
  2159. {
  2160.   if (! operands_match_p (operands[0], operands[1]))
  2161.     {
  2162.       if (!ADDRESS_REG_P (operands[1]))
  2163.     {
  2164.       rtx tmp = operands[1];
  2165.  
  2166.       operands[1] = operands[2];
  2167.       operands[2] = tmp;
  2168.     }
  2169.  
  2170.       /* These insns can result from reloads to access
  2171.      stack slots over 64k from the frame pointer.  */
  2172.       if (((GET_CODE (operands[2]) == CONST_INT
  2173.        && INTVAL (operands[2]) + 0x8000 >= (unsigned) 0x10000))
  2174.       || (flag_pic == 4 && operands[1] == pic_offset_table_rtx))
  2175.         return \"move%.l %2,%0\;add%.l %1,%0\";
  2176. #ifdef SGS
  2177.       if (GET_CODE (operands[2]) == REG)
  2178.     return \"lea 0(%1,%2.l),%0\";
  2179.       else
  2180.     return \"lea %c2(%1),%0\";
  2181. #else /* not SGS */
  2182. #ifdef MOTOROLA
  2183.       if (GET_CODE (operands[2]) == REG)
  2184.     return \"lea (%1,%2.l),%0\";
  2185.       else
  2186.     return \"lea (%c2,%1),%0\";
  2187. #else /* not MOTOROLA (MIT syntax) */
  2188.       if (GET_CODE (operands[2]) == REG)
  2189.     return \"lea %1@(0,%2:l),%0\";
  2190.       else
  2191.     return \"lea %1@(%c2),%0\";
  2192. #endif /* not MOTOROLA */
  2193. #endif /* not SGS */
  2194.     }
  2195.   if (GET_CODE (operands[2]) == CONST_INT)
  2196.     {
  2197. #ifndef NO_ADDSUB_Q
  2198.       if (INTVAL (operands[2]) > 0
  2199.       && INTVAL (operands[2]) <= 8)
  2200.     return (ADDRESS_REG_P (operands[0])
  2201.         ? \"addq%.w %2,%0\"
  2202.         : \"addq%.l %2,%0\");
  2203.       if (INTVAL (operands[2]) < 0
  2204.       && INTVAL (operands[2]) >= -8)
  2205.         {
  2206.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2207.                      - INTVAL (operands[2]));
  2208.       return (ADDRESS_REG_P (operands[0])
  2209.           ? \"subq%.w %2,%0\"
  2210.           : \"subq%.l %2,%0\");
  2211.     }
  2212.       /* On everything except the 68000 it is faster to use two
  2213.      addqw instructions to add a small integer (8 < N <= 16)
  2214.      to an address register.  Likewise for subqw.*/
  2215.       if (INTVAL (operands[2]) > 8
  2216.       && INTVAL (operands[2]) <= 16
  2217.       && ADDRESS_REG_P (operands[0])
  2218.       && TARGET_68020) 
  2219.     {
  2220.       operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 8);
  2221.       return \"addq%.w %#8,%0\;addq%.w %2,%0\";
  2222.     }
  2223.       if (INTVAL (operands[2]) < -8
  2224.       && INTVAL (operands[2]) >= -16
  2225.       && ADDRESS_REG_P (operands[0])
  2226.       && TARGET_68020) 
  2227.     {
  2228.       operands[2] = gen_rtx (CONST_INT, VOIDmode, 
  2229.                   - INTVAL (operands[2]) - 8);
  2230.       return \"subq%.w %#8,%0\;subq%.w %2,%0\";
  2231.     }
  2232. #endif
  2233.       if (ADDRESS_REG_P (operands[0])
  2234.       && INTVAL (operands[2]) >= -0x8000
  2235.       && INTVAL (operands[2]) < 0x8000)
  2236.     return \"add%.w %2,%0\";
  2237.     }
  2238.   return \"add%.l %2,%0\";
  2239. }")
  2240.  
  2241. (define_insn ""
  2242.   [(set (match_operand:SI 0 "general_operand" "=a")
  2243.     (plus:SI (match_operand:SI 1 "general_operand" "0")
  2244.          (sign_extend:SI
  2245.           (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
  2246.   ""
  2247.   "add%.w %2,%0")
  2248.  
  2249. (define_insn "addhi3"
  2250.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  2251.     (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
  2252.          (match_operand:HI 2 "general_operand" "dn,rmn")))]
  2253.   ""
  2254.   "*
  2255. {
  2256. #ifndef NO_ADDSUB_Q
  2257.   if (GET_CODE (operands[2]) == CONST_INT)
  2258.     {
  2259.       /* If the constant would be a negative number when interpreted as
  2260.      HImode, make it negative.  This is usually, but not always, done
  2261.      elsewhere in the compiler.  First check for constants out of range,
  2262.      which could confuse us.  */
  2263.  
  2264.       if (INTVAL (operands[2]) >= 32768)
  2265.     operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2266.                    INTVAL (operands[2]) - 65536);
  2267.  
  2268.       if (INTVAL (operands[2]) > 0
  2269.       && INTVAL (operands[2]) <= 8)
  2270.     return \"addq%.w %2,%0\";
  2271.       if (INTVAL (operands[2]) < 0
  2272.       && INTVAL (operands[2]) >= -8)
  2273.     {
  2274.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2275.                      - INTVAL (operands[2]));
  2276.       return \"subq%.w %2,%0\";
  2277.     }
  2278.       /* On everything except the 68000 it is faster to use two
  2279.      addqw instructions to add a small integer (8 < N <= 16)
  2280.      to an address register.  Likewise for subqw. */
  2281.       if (INTVAL (operands[2]) > 8
  2282.       && INTVAL (operands[2]) <= 16
  2283.       && ADDRESS_REG_P (operands[0])
  2284.       && TARGET_68020) 
  2285.     {
  2286.       operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 8);
  2287.       return \"addq%.w %#8,%0\;addq%.w %2,%0\";
  2288.     }
  2289.       if (INTVAL (operands[2]) < -8
  2290.       && INTVAL (operands[2]) >= -16
  2291.       && ADDRESS_REG_P (operands[0])
  2292.       && TARGET_68020) 
  2293.     {
  2294.       operands[2] = gen_rtx (CONST_INT, VOIDmode, 
  2295.                  - INTVAL (operands[2]) - 8);
  2296.       return \"subq%.w %#8,%0\;subq%.w %2,%0\";
  2297.     }
  2298.     }
  2299. #endif
  2300.   return \"add%.w %2,%0\";
  2301. }")
  2302.  
  2303. ;; These insns must use MATCH_DUP instead of the more expected
  2304. ;; use of a matching constraint because the "output" here is also
  2305. ;; an input, so you can't use the matching constraint.  That also means
  2306. ;; that you can't use the "%", so you need patterns with the matched
  2307. ;; operand in both positions.
  2308.  
  2309. (define_insn ""
  2310.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  2311.     (plus:HI (match_dup 0)
  2312.          (match_operand:HI 1 "general_operand" "dn,rmn")))]
  2313.   ""
  2314.   "*
  2315. {
  2316. #ifndef NO_ADDSUB_Q
  2317.   if (GET_CODE (operands[1]) == CONST_INT)
  2318.     {
  2319.       /* If the constant would be a negative number when interpreted as
  2320.      HImode, make it negative.  This is usually, but not always, done
  2321.      elsewhere in the compiler.  First check for constants out of range,
  2322.      which could confuse us.  */
  2323.  
  2324.       if (INTVAL (operands[1]) >= 32768)
  2325.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2326.                    INTVAL (operands[1]) - 65536);
  2327.  
  2328.       if (INTVAL (operands[1]) > 0
  2329.       && INTVAL (operands[1]) <= 8)
  2330.     return \"addq%.w %1,%0\";
  2331.       if (INTVAL (operands[1]) < 0
  2332.       && INTVAL (operands[1]) >= -8)
  2333.     {
  2334.       operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2335.                      - INTVAL (operands[1]));
  2336.       return \"subq%.w %1,%0\";
  2337.     }
  2338.       /* On everything except the 68000 it is faster to use two
  2339.      addqw instructions to add a small integer (8 < N <= 16)
  2340.      to an address register.  Likewise for subqw. */
  2341.       if (INTVAL (operands[1]) > 8
  2342.       && INTVAL (operands[1]) <= 16
  2343.       && ADDRESS_REG_P (operands[0])
  2344.       && TARGET_68020) 
  2345.     {
  2346.       operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) - 8);
  2347.       return \"addq%.w %#8,%0\;addq%.w %1,%0\";
  2348.     }
  2349.       if (INTVAL (operands[1]) < -8
  2350.       && INTVAL (operands[1]) >= -16
  2351.       && ADDRESS_REG_P (operands[0])
  2352.       && TARGET_68020) 
  2353.     {
  2354.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  2355.                  - INTVAL (operands[1]) - 8);
  2356.       return \"subq%.w %#8,%0\;subq%.w %1,%0\";
  2357.     }
  2358.     }
  2359. #endif
  2360.   return \"add%.w %1,%0\";
  2361. }")
  2362.  
  2363. (define_insn ""
  2364.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  2365.     (plus:HI (match_operand:HI 1 "general_operand" "dn,rmn")
  2366.          (match_dup 0)))]
  2367.   ""
  2368.   "*
  2369. {
  2370. #ifndef NO_ADDSUB_Q
  2371.   if (GET_CODE (operands[1]) == CONST_INT)
  2372.     {
  2373.       /* If the constant would be a negative number when interpreted as
  2374.      HImode, make it negative.  This is usually, but not always, done
  2375.      elsewhere in the compiler.  First check for constants out of range,
  2376.      which could confuse us.  */
  2377.  
  2378.       if (INTVAL (operands[1]) >= 32768)
  2379.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2380.                    INTVAL (operands[1]) - 65536);
  2381.  
  2382.       if (INTVAL (operands[1]) > 0
  2383.       && INTVAL (operands[1]) <= 8)
  2384.     return \"addq%.w %1,%0\";
  2385.       if (INTVAL (operands[1]) < 0
  2386.       && INTVAL (operands[1]) >= -8)
  2387.     {
  2388.       operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2389.                      - INTVAL (operands[1]));
  2390.       return \"subq%.w %1,%0\";
  2391.     }
  2392.       /* On everything except the 68000 it is faster to use two
  2393.      addqw instructions to add a small integer (8 < N <= 16)
  2394.      to an address register.  Likewise for subqw. */
  2395.       if (INTVAL (operands[1]) > 8
  2396.       && INTVAL (operands[1]) <= 16
  2397.       && ADDRESS_REG_P (operands[0])
  2398.       && TARGET_68020) 
  2399.     {
  2400.       operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) - 8);
  2401.       return \"addq%.w %#8,%0\;addq%.w %1,%0\";
  2402.     }
  2403.       if (INTVAL (operands[1]) < -8
  2404.       && INTVAL (operands[1]) >= -16
  2405.       && ADDRESS_REG_P (operands[0])
  2406.       && TARGET_68020) 
  2407.     {
  2408.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  2409.                  - INTVAL (operands[1]) - 8);
  2410.       return \"subq%.w %#8,%0\;subq%.w %1,%0\";
  2411.     }
  2412.     }
  2413. #endif
  2414.   return \"add%.w %1,%0\";
  2415. }")
  2416.  
  2417. (define_insn "addqi3"
  2418.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2419.     (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
  2420.          (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2421.   ""
  2422.   "*
  2423. {
  2424. #ifndef NO_ADDSUB_Q
  2425.   if (GET_CODE (operands[2]) == CONST_INT)
  2426.     {
  2427.       if (INTVAL (operands[2]) >= 128)
  2428.     operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2429.                    INTVAL (operands[2]) - 256);
  2430.  
  2431.       if (INTVAL (operands[2]) > 0
  2432.       && INTVAL (operands[2]) <= 8)
  2433.     return \"addq%.b %2,%0\";
  2434.       if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
  2435.        {
  2436.      operands[2] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[2]));
  2437.      return \"subq%.b %2,%0\";
  2438.        }
  2439.     }
  2440. #endif
  2441.   return \"add%.b %2,%0\";
  2442. }")
  2443.  
  2444. (define_insn ""
  2445.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  2446.     (plus:QI (match_dup 0)
  2447.          (match_operand:QI 1 "general_operand" "dn,dmn")))]
  2448.   ""
  2449.   "*
  2450. {
  2451. #ifndef NO_ADDSUB_Q
  2452.   if (GET_CODE (operands[1]) == CONST_INT)
  2453.     {
  2454.       if (INTVAL (operands[1]) >= 128)
  2455.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2456.                    INTVAL (operands[1]) - 256);
  2457.  
  2458.       if (INTVAL (operands[1]) > 0
  2459.       && INTVAL (operands[1]) <= 8)
  2460.     return \"addq%.b %1,%0\";
  2461.       if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
  2462.        {
  2463.      operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
  2464.      return \"subq%.b %1,%0\";
  2465.        }
  2466.     }
  2467. #endif
  2468.   return \"add%.b %1,%0\";
  2469. }")
  2470.  
  2471. (define_insn ""
  2472.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  2473.     (plus:QI (match_operand:QI 1 "general_operand" "dn,dmn")
  2474.          (match_dup 0)))]
  2475.   ""
  2476.   "*
  2477. {
  2478. #ifndef NO_ADDSUB_Q
  2479.   if (GET_CODE (operands[1]) == CONST_INT)
  2480.     {
  2481.       if (INTVAL (operands[1]) >= 128)
  2482.     operands[1] = gen_rtx (CONST_INT, VOIDmode,
  2483.                    INTVAL (operands[1]) - 256);
  2484.  
  2485.       if (INTVAL (operands[1]) > 0
  2486.       && INTVAL (operands[1]) <= 8)
  2487.     return \"addq%.b %1,%0\";
  2488.       if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
  2489.        {
  2490.      operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
  2491.      return \"subq%.b %1,%0\";
  2492.        }
  2493.     }
  2494. #endif
  2495.   return \"add%.b %1,%0\";
  2496. }")
  2497.  
  2498. (define_expand "adddf3"
  2499.   [(set (match_operand:DF 0 "general_operand" "")
  2500.     (plus:DF (match_operand:DF 1 "general_operand" "")
  2501.          (match_operand:DF 2 "general_operand" "")))]
  2502.   "TARGET_68881 || TARGET_FPA"
  2503.   "")
  2504.  
  2505. (define_insn ""
  2506.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  2507.     (plus:DF (match_operand:DF 1 "general_operand" "%xH,y")
  2508.          (match_operand:DF 2 "general_operand" "xH,dmF")))]
  2509.   "TARGET_FPA"
  2510.   "*
  2511. {
  2512.   if (rtx_equal_p (operands[0], operands[1]))
  2513.     return \"fpadd%.d %y2,%0\";
  2514.   if (rtx_equal_p (operands[0], operands[2]))
  2515.     return \"fpadd%.d %y1,%0\";
  2516.   if (which_alternative == 0)
  2517.     return \"fpadd3%.d %w2,%w1,%0\";
  2518.   return \"fpadd3%.d %x2,%x1,%0\";
  2519. }")
  2520.  
  2521. (define_insn ""
  2522.   [(set (match_operand:DF 0 "general_operand" "=f")
  2523.     (plus:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
  2524.          (match_operand:DF 1 "general_operand" "0")))]
  2525.   "TARGET_68881"
  2526.   "f%&add%.l %2,%0")
  2527.  
  2528. (define_insn ""
  2529.   [(set (match_operand:DF 0 "general_operand" "=f")
  2530.     (plus:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
  2531.          (match_operand:DF 1 "general_operand" "0")))]
  2532.   "TARGET_68881"
  2533.   "f%&add%.w %2,%0")
  2534.  
  2535. (define_insn ""
  2536.   [(set (match_operand:DF 0 "general_operand" "=f")
  2537.     (plus:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
  2538.          (match_operand:DF 1 "general_operand" "0")))]
  2539.   "TARGET_68881"
  2540.   "f%&add%.b %2,%0")
  2541.  
  2542. (define_insn ""
  2543.   [(set (match_operand:DF 0 "general_operand" "=f")
  2544.     (plus:DF (match_operand:DF 1 "general_operand" "%0")
  2545.          (match_operand:DF 2 "general_operand" "fmG")))]
  2546.   "TARGET_68881"
  2547.   "*
  2548. {
  2549.   if (REG_P (operands[2]))
  2550.     return \"f%&add%.x %2,%0\";
  2551.   return \"f%&add%.d %f2,%0\";
  2552. }")
  2553.  
  2554. (define_expand "addsf3"
  2555.   [(set (match_operand:SF 0 "general_operand" "")
  2556.     (plus:SF (match_operand:SF 1 "general_operand" "")
  2557.          (match_operand:SF 2 "general_operand" "")))]
  2558.   "TARGET_68881 || TARGET_FPA"
  2559.   "")
  2560.  
  2561. (define_insn ""
  2562.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  2563.     (plus:SF (match_operand:SF 1 "general_operand" "%xH,y")
  2564.          (match_operand:SF 2 "general_operand" "xH,rmF")))]
  2565.   "TARGET_FPA"
  2566.   "*
  2567. {
  2568.   if (rtx_equal_p (operands[0], operands[1]))
  2569.     return \"fpadd%.s %w2,%0\";
  2570.   if (rtx_equal_p (operands[0], operands[2]))
  2571.     return \"fpadd%.s %w1,%0\";
  2572.   if (which_alternative == 0)
  2573.     return \"fpadd3%.s %w2,%w1,%0\";
  2574.   return \"fpadd3%.s %2,%1,%0\";
  2575. }")
  2576.  
  2577. (define_insn ""
  2578.   [(set (match_operand:SF 0 "general_operand" "=f")
  2579.     (plus:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
  2580.          (match_operand:SF 1 "general_operand" "0")))]
  2581.   "TARGET_68881"
  2582.   "f%$add%.l %2,%0")
  2583.  
  2584. (define_insn ""
  2585.   [(set (match_operand:SF 0 "general_operand" "=f")
  2586.     (plus:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
  2587.          (match_operand:SF 1 "general_operand" "0")))]
  2588.   "TARGET_68881"
  2589.   "f%$add%.w %2,%0")
  2590.  
  2591. (define_insn ""
  2592.   [(set (match_operand:SF 0 "general_operand" "=f")
  2593.     (plus:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
  2594.          (match_operand:SF 1 "general_operand" "0")))]
  2595.   "TARGET_68881"
  2596.   "f%$add%.b %2,%0")
  2597.  
  2598. (define_insn ""
  2599.   [(set (match_operand:SF 0 "general_operand" "=f")
  2600.     (plus:SF (match_operand:SF 1 "general_operand" "%0")
  2601.          (match_operand:SF 2 "general_operand" "fdmF")))]
  2602.   "TARGET_68881"
  2603.   "*
  2604. {
  2605.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2606.     return \"f%$add%.x %2,%0\";
  2607.   return \"f%$add%.s %f2,%0\";
  2608. }")
  2609.  
  2610. ;; subtract instructions
  2611.  
  2612. (define_insn "subdia_sexthishl32"
  2613.   [(set (match_operand:DI 0 "register_operand" "+a")
  2614.     (minus:DI (match_dup 0)
  2615.         (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm"))
  2616.             (const_int 32))))]
  2617.   ""
  2618.   "*
  2619. {
  2620.   CC_STATUS_INIT;
  2621.   return \"sub%.w %1,%0\";
  2622. } ")
  2623.  
  2624. (define_insn "subdid_sexthishl32"
  2625.   [(set (match_operand:DI 0 "general_operand" "+ro")
  2626.     (minus:DI (match_dup 0)
  2627.         (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm"))
  2628.             (const_int 32))))
  2629.    (clobber (match_scratch:SI 2 "=a"))]
  2630.   ""
  2631.   "*
  2632. {
  2633.   CC_STATUS_INIT;
  2634.   return \"move%.w %1,%2\;sub%.l %2,%0\";
  2635. } ")
  2636.  
  2637. (define_insn "subdi_dishl32"
  2638.   [(set (match_operand:DI 0 "general_operand" "+ro")
  2639.     (minus:DI (match_dup 0)
  2640.         (ashift:DI (match_operand:DI 1 "general_operand" "ro")
  2641.             (const_int 32))))]
  2642.   ""
  2643.   "*
  2644. {
  2645.   CC_STATUS_INIT;
  2646.   if (GET_CODE (operands[1]) == REG)
  2647.     operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  2648.   else
  2649.     operands[1] = adj_offsettable_operand (operands[1], 4);
  2650.   return \"sub%.l %1,%0\";
  2651. } ")
  2652.  
  2653. (define_insn "subdi3"
  2654.   [(set (match_operand:DI 0 "general_operand" "=d,<,d,o<>")
  2655.     (minus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0")
  2656.          (match_operand:DI 2 "general_operand" "d,<,*ao>,d")))
  2657.    (clobber (match_scratch:SI 3 "=X,X,d,d"))]
  2658.   ""
  2659.   "*
  2660. {
  2661.   if (DATA_REG_P (operands[0]))
  2662.     {
  2663.       if (DATA_REG_P (operands[2]))
  2664.     return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
  2665.       else if (GET_CODE (operands[2]) == MEM
  2666.       && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
  2667.     {
  2668.       return \"move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0\";
  2669.     }
  2670.       else
  2671.     {
  2672.       /* TODO : this should work also for CONST operands[2] */
  2673.       if (GET_CODE (operands[2]) == REG)
  2674.         operands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
  2675.       else
  2676.         operands[1] = adj_offsettable_operand (operands[2], 4);
  2677.       return \"move%.l %2,%3\;sub%.l %1,%R0\;subx%.l %3,%0\";
  2678.     }
  2679.     }
  2680.   else if (GET_CODE (operands[0]) == MEM)
  2681.     {
  2682.       if (GET_CODE (operands[2]) == MEM
  2683.       && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
  2684.     return \"sub%.l %2,%0\;subx%.l %2,%0\";
  2685.       CC_STATUS_INIT;
  2686.       if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  2687.     {
  2688.       operands[1] = gen_rtx (MEM, SImode,
  2689.            gen_rtx (PLUS, VOIDmode, XEXP(operands[0], 0),
  2690.                 gen_rtx (CONST_INT, VOIDmode, -8)));
  2691.       return \"move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1\";
  2692.     }
  2693.       else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  2694.     {
  2695.       operands[1] = XEXP(operands[0], 0);
  2696.       return \"sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1\";
  2697.     }
  2698.       else
  2699.     {
  2700.       operands[1] = adj_offsettable_operand (operands[0], 4);
  2701.       return \"sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0\";
  2702.     }
  2703.     }
  2704. } ")
  2705.  
  2706. (define_insn "subsi3"
  2707.   [(set (match_operand:SI 0 "general_operand" "=m,r")
  2708.     (minus:SI (match_operand:SI 1 "general_operand" "0,0")
  2709.           (match_operand:SI 2 "general_operand" "ds,mrs")))]
  2710.   ""
  2711.   "sub%.l %2,%0")
  2712.  
  2713. (define_insn ""
  2714.   [(set (match_operand:SI 0 "general_operand" "=a")
  2715.     (minus:SI (match_operand:SI 1 "general_operand" "0")
  2716.           (sign_extend:SI
  2717.            (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
  2718.   ""
  2719.   "sub%.w %2,%0")
  2720.  
  2721. (define_insn "subhi3"
  2722.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  2723.     (minus:HI (match_operand:HI 1 "general_operand" "0,0")
  2724.           (match_operand:HI 2 "general_operand" "dn,rmn")))]
  2725.   ""
  2726.   "sub%.w %2,%0")
  2727.  
  2728. (define_insn ""
  2729.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  2730.     (minus:HI (match_dup 0)
  2731.           (match_operand:HI 1 "general_operand" "dn,rmn")))]
  2732.   ""
  2733.   "sub%.w %1,%0")
  2734.  
  2735. (define_insn "subqi3"
  2736.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2737.     (minus:QI (match_operand:QI 1 "general_operand" "0,0")
  2738.           (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2739.   ""
  2740.   "sub%.b %2,%0")
  2741.  
  2742. (define_insn ""
  2743.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  2744.     (minus:QI (match_dup 0)
  2745.           (match_operand:QI 1 "general_operand" "dn,dmn")))]
  2746.   ""
  2747.   "sub%.b %1,%0")
  2748.  
  2749. (define_expand "subdf3"
  2750.   [(set (match_operand:DF 0 "general_operand" "")
  2751.     (minus:DF (match_operand:DF 1 "general_operand" "")
  2752.           (match_operand:DF 2 "general_operand" "")))]
  2753.   "TARGET_68881 || TARGET_FPA"
  2754.   "")
  2755.  
  2756. (define_insn ""
  2757.   [(set (match_operand:DF 0 "general_operand" "=x,y,y")
  2758.     (minus:DF (match_operand:DF 1 "general_operand" "xH,y,dmF")
  2759.           (match_operand:DF 2 "general_operand" "xH,dmF,0")))]
  2760.   "TARGET_FPA"
  2761.   "*
  2762. {
  2763.   if (rtx_equal_p (operands[0], operands[2]))
  2764.     return \"fprsub%.d %y1,%0\";
  2765.   if (rtx_equal_p (operands[0], operands[1]))
  2766.     return \"fpsub%.d %y2,%0\";
  2767.   if (which_alternative == 0)
  2768.     return \"fpsub3%.d %w2,%w1,%0\";
  2769.   return \"fpsub3%.d %x2,%x1,%0\";
  2770. }")
  2771.  
  2772. (define_insn ""
  2773.   [(set (match_operand:DF 0 "general_operand" "=f")
  2774.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  2775.           (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
  2776.   "TARGET_68881"
  2777.   "f%&sub%.l %2,%0")
  2778.  
  2779. (define_insn ""
  2780.   [(set (match_operand:DF 0 "general_operand" "=f")
  2781.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  2782.           (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
  2783.   "TARGET_68881"
  2784.   "f%&sub%.w %2,%0")
  2785.  
  2786. (define_insn ""
  2787.   [(set (match_operand:DF 0 "general_operand" "=f")
  2788.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  2789.           (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
  2790.   "TARGET_68881"
  2791.   "f%&sub%.b %2,%0")
  2792.  
  2793. (define_insn ""
  2794.   [(set (match_operand:DF 0 "general_operand" "=f")
  2795.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  2796.           (match_operand:DF 2 "general_operand" "fmG")))]
  2797.   "TARGET_68881"
  2798.   "*
  2799. {
  2800.   if (REG_P (operands[2]))
  2801.     return \"f%&sub%.x %2,%0\";
  2802.   return \"f%&sub%.d %f2,%0\";
  2803. }")
  2804.  
  2805. (define_expand "subsf3"
  2806.   [(set (match_operand:SF 0 "general_operand" "")
  2807.     (minus:SF (match_operand:SF 1 "general_operand" "")
  2808.           (match_operand:SF 2 "general_operand" "")))]
  2809.   "TARGET_68881 || TARGET_FPA"
  2810.   "")
  2811.  
  2812. (define_insn ""
  2813.   [(set (match_operand:SF 0 "general_operand" "=x,y,y")
  2814.     (minus:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
  2815.           (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
  2816.   "TARGET_FPA"
  2817.   "*
  2818. {
  2819.   if (rtx_equal_p (operands[0], operands[2]))
  2820.     return \"fprsub%.s %w1,%0\";
  2821.   if (rtx_equal_p (operands[0], operands[1]))
  2822.     return \"fpsub%.s %w2,%0\";
  2823.   if (which_alternative == 0)
  2824.     return \"fpsub3%.s %w2,%w1,%0\";
  2825.   return \"fpsub3%.s %2,%1,%0\";
  2826. }")
  2827.  
  2828. (define_insn ""
  2829.   [(set (match_operand:SF 0 "general_operand" "=f")
  2830.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  2831.           (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
  2832.   "TARGET_68881"
  2833.   "f%$sub%.l %2,%0")
  2834.  
  2835. (define_insn ""
  2836.   [(set (match_operand:SF 0 "general_operand" "=f")
  2837.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  2838.           (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
  2839.   "TARGET_68881"
  2840.   "f%$sub%.w %2,%0")
  2841.  
  2842. (define_insn ""
  2843.   [(set (match_operand:SF 0 "general_operand" "=f")
  2844.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  2845.           (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
  2846.   "TARGET_68881"
  2847.   "f%$sub%.b %2,%0")
  2848.  
  2849. (define_insn ""
  2850.   [(set (match_operand:SF 0 "general_operand" "=f")
  2851.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  2852.           (match_operand:SF 2 "general_operand" "fdmF")))]
  2853.   "TARGET_68881"
  2854.   "*
  2855. {
  2856.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2857.     return \"f%$sub%.x %2,%0\";
  2858.   return \"f%$sub%.s %f2,%0\";
  2859. }")
  2860.  
  2861. ;; multiply instructions
  2862.  
  2863. (define_insn "mulhi3"
  2864.   [(set (match_operand:HI 0 "general_operand" "=d")
  2865.     (mult:HI (match_operand:HI 1 "general_operand" "%0")
  2866.          (match_operand:HI 2 "general_operand" "dmn")))]
  2867.   ""
  2868.   "*
  2869. {
  2870. #if defined(MOTOROLA) && !defined(CRDS)
  2871.   return \"muls%.w %2,%0\";
  2872. #else
  2873.   return \"muls %2,%0\";
  2874. #endif
  2875. }")
  2876.  
  2877. (define_insn "mulhisi3"
  2878.   [(set (match_operand:SI 0 "general_operand" "=d")
  2879.     (mult:SI (sign_extend:SI
  2880.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2881.          (sign_extend:SI
  2882.           (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
  2883.   ""
  2884.   "*
  2885. {
  2886. #if defined(MOTOROLA) && !defined(CRDS)
  2887.   return \"muls%.w %2,%0\";
  2888. #else
  2889.   return \"muls %2,%0\";
  2890. #endif
  2891. }")
  2892.  
  2893. (define_insn ""
  2894.   [(set (match_operand:SI 0 "general_operand" "=d")
  2895.     (mult:SI (sign_extend:SI
  2896.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2897.          (match_operand:SI 2 "const_int_operand" "n")))]
  2898.   "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
  2899.   "*
  2900. {
  2901. #if defined(MOTOROLA) && !defined(CRDS)
  2902.   return \"muls%.w %2,%0\";
  2903. #else
  2904.   return \"muls %2,%0\";
  2905. #endif
  2906. }")
  2907.  
  2908. (define_insn "mulsi3"
  2909.   [(set (match_operand:SI 0 "general_operand" "=d")
  2910.     (mult:SI (match_operand:SI 1 "general_operand" "%0")
  2911.          (match_operand:SI 2 "general_operand" "dmsK")))]
  2912.   "TARGET_68020"
  2913.   "muls%.l %2,%0")
  2914.  
  2915. (define_insn "umulhisi3"
  2916.   [(set (match_operand:SI 0 "general_operand" "=d")
  2917.     (mult:SI (zero_extend:SI
  2918.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2919.          (zero_extend:SI
  2920.           (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
  2921.   ""
  2922.   "*
  2923. {
  2924. #if defined(MOTOROLA) && !defined(CRDS)
  2925.   return \"mulu%.w %2,%0\";
  2926. #else
  2927.   return \"mulu %2,%0\";
  2928. #endif
  2929. }")
  2930.  
  2931. (define_insn ""
  2932.   [(set (match_operand:SI 0 "general_operand" "=d")
  2933.     (mult:SI (zero_extend:SI
  2934.           (match_operand:HI 1 "nonimmediate_operand" "%0"))
  2935.          (match_operand:SI 2 "const_int_operand" "n")))]
  2936.   "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
  2937.   "*
  2938. {
  2939. #if defined(MOTOROLA) && !defined(CRDS)
  2940.   return \"mulu%.w %2,%0\";
  2941. #else
  2942.   return \"mulu %2,%0\";
  2943. #endif
  2944. }")
  2945.  
  2946. ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
  2947. ;; proper matching constraint.  This is because the matching is between
  2948. ;; the high-numbered word of the DImode operand[0] and operand[1].
  2949. (define_expand "umulsidi3"
  2950.   [(parallel
  2951.     [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
  2952.       (mult:SI (match_operand:SI 1 "register_operand" "")
  2953.            (match_operand:SI 2 "nonimmediate_operand" "")))
  2954.      (set (subreg:SI (match_dup 0) 0)
  2955.       (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
  2956.                          (zero_extend:DI (match_dup 2)))
  2957.                     (const_int 32))))])]
  2958.   "TARGET_68020"
  2959.   "")
  2960.  
  2961. (define_insn ""
  2962.   [(set (match_operand:SI 0 "register_operand" "=d")
  2963.     (mult:SI (match_operand:SI 1 "register_operand" "%0")
  2964.           (match_operand:SI 2 "nonimmediate_operand" "dm")))
  2965.    (set (match_operand:SI 3 "register_operand" "=d")
  2966.     (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
  2967.                        (zero_extend:DI (match_dup 2)))
  2968.                   (const_int 32))))]
  2969.   "TARGET_68020"
  2970.   "mulu%.l %2,%3:%0")
  2971.  
  2972. ; Match immediate case.  For 2.4 only match things < 2^31.
  2973. ; It's tricky with larger values in these patterns since we need to match
  2974. ; values between the two parallel multiplies, between a CONST_DOUBLE and
  2975. ; a CONST_INT.
  2976. (define_insn ""
  2977.   [(set (match_operand:SI 0 "register_operand" "=d")
  2978.     (mult:SI (match_operand:SI 1 "register_operand" "%0")
  2979.          (match_operand:SI 2 "const_int_operand" "n")))
  2980.    (set (match_operand:SI 3 "register_operand" "=d")
  2981.     (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
  2982.                        (match_dup 2))
  2983.                   (const_int 32))))]
  2984.   "TARGET_68020
  2985.    && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
  2986.   "mulu%.l %2,%3:%0")
  2987.  
  2988. (define_expand "mulsidi3"
  2989.   [(parallel
  2990.     [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
  2991.       (mult:SI (match_operand:SI 1 "register_operand" "")
  2992.            (match_operand:SI 2 "nonimmediate_operand" "")))
  2993.      (set (subreg:SI (match_dup 0) 0)
  2994.       (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
  2995.                          (sign_extend:DI (match_dup 2)))
  2996.                     (const_int 32))))])]
  2997.   "TARGET_68020"
  2998.   "")
  2999.  
  3000. (define_insn ""
  3001.   [(set (match_operand:SI 0 "register_operand" "=d")
  3002.     (mult:SI (match_operand:SI 1 "register_operand" "%0")
  3003.          (match_operand:SI 2 "nonimmediate_operand" "dm")))
  3004.    (set (match_operand:SI 3 "register_operand" "=d")
  3005.     (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
  3006.                        (sign_extend:DI (match_dup 2)))
  3007.                   (const_int 32))))]
  3008.   "TARGET_68020"
  3009.   "muls%.l %2,%3:%0")
  3010.  
  3011. (define_insn ""
  3012.   [(set (match_operand:SI 0 "register_operand" "=d")
  3013.     (mult:SI (match_operand:SI 1 "register_operand" "%0")
  3014.          (match_operand:SI 2 "const_int_operand" "n")))
  3015.    (set (match_operand:SI 3 "register_operand" "=d")
  3016.     (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
  3017.                        (match_dup 2))
  3018.                   (const_int 32))))]
  3019.   "TARGET_68020
  3020.    /* This test is a noop on 32 bit machines,
  3021.       but important for a cross-compiler hosted on 64-bit machines.  */
  3022.    && INTVAL (operands[2]) <= 0x7fffffff
  3023.    && INTVAL (operands[2]) >= -0x80000000"
  3024.   "muls%.l %2,%3:%0")
  3025.  
  3026. (define_expand "umulsi3_highpart"
  3027.   [(parallel
  3028.     [(set (match_operand:SI 0 "register_operand" "")
  3029.       (truncate:SI
  3030.        (lshiftrt:DI
  3031.         (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
  3032.              (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
  3033.         (const_int 32))))
  3034.      (clobber (match_dup 3))])]
  3035.   "TARGET_68020"
  3036.   "
  3037. {
  3038.   operands[3] = gen_reg_rtx (SImode);
  3039.   if (GET_CODE (operands[2]) == CONST_INT
  3040.       || GET_CODE (operands[2]) == CONST_DOUBLE)
  3041.     {
  3042.       if (! const_uint32_operand (operands[2], VOIDmode))
  3043.     abort ();
  3044.       /* We have to adjust the operand order for the matching constraints.  */
  3045.       emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
  3046.                          operands[1], operands[2]));
  3047.       DONE;
  3048.     }
  3049. }")
  3050.  
  3051. (define_insn ""
  3052.   [(set (match_operand:SI 0 "register_operand" "=d")
  3053.     (truncate:SI
  3054.      (lshiftrt:DI
  3055.       (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
  3056.            (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
  3057.       (const_int 32))))
  3058.    (clobber (match_operand:SI 1 "register_operand" "=d"))]
  3059.   "TARGET_68020"
  3060.   "mulu%.l %3,%0:%1")
  3061.  
  3062. (define_insn "const_umulsi3_highpart"
  3063.   [(set (match_operand:SI 0 "register_operand" "=d")
  3064.     (truncate:SI
  3065.      (lshiftrt:DI
  3066.       (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
  3067.            (match_operand 3 "const_uint32_operand" ""))
  3068.       (const_int 32))))
  3069.    (clobber (match_operand:SI 1 "register_operand" "=d"))]
  3070.   "TARGET_68020"
  3071.   "mulu%.l %3,%0:%1")
  3072.  
  3073. (define_expand "smulsi3_highpart"
  3074.   [(parallel
  3075.     [(set (match_operand:SI 0 "register_operand" "")
  3076.       (truncate:SI
  3077.        (lshiftrt:DI
  3078.         (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
  3079.              (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
  3080.         (const_int 32))))
  3081.      (clobber (match_dup 3))])]
  3082.   "TARGET_68020"
  3083.   "
  3084. {
  3085.   operands[3] = gen_reg_rtx (SImode);
  3086.   if (GET_CODE (operands[2]) == CONST_INT
  3087.       || GET_CODE (operands[2]) == CONST_DOUBLE)
  3088.     {
  3089.       if (! const_sint32_operand (operands[2], VOIDmode))
  3090.     abort ();
  3091.       /* We have to adjust the operand order for the matching constraints.  */
  3092.       emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
  3093.                          operands[1], operands[2]));
  3094.       DONE;
  3095.     }
  3096. }")
  3097.  
  3098. (define_insn ""
  3099.   [(set (match_operand:SI 0 "register_operand" "=d")
  3100.     (truncate:SI
  3101.      (lshiftrt:DI
  3102.       (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
  3103.            (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
  3104.       (const_int 32))))
  3105.    (clobber (match_operand:SI 1 "register_operand" "=d"))]
  3106.   "TARGET_68020"
  3107.   "muls%.l %3,%0:%1")
  3108.  
  3109. (define_insn "const_smulsi3_highpart"
  3110.   [(set (match_operand:SI 0 "register_operand" "=d")
  3111.     (truncate:SI
  3112.      (lshiftrt:DI
  3113.       (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
  3114.            (match_operand 3 "const_sint32_operand" ""))
  3115.       (const_int 32))))
  3116.    (clobber (match_operand:SI 1 "register_operand" "=d"))]
  3117.   "TARGET_68020"
  3118.   "muls%.l %3,%0:%1")
  3119.  
  3120. (define_expand "muldf3"
  3121.   [(set (match_operand:DF 0 "general_operand" "")
  3122.     (mult:DF (match_operand:DF 1 "general_operand" "")
  3123.          (match_operand:DF 2 "general_operand" "")))]
  3124.   "TARGET_68881 || TARGET_FPA"
  3125.   "")
  3126.  
  3127. (define_insn ""
  3128.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  3129.     (mult:DF (match_operand:DF 1 "general_operand" "%xH,y")
  3130.          (match_operand:DF 2 "general_operand" "xH,rmF")))]
  3131.   "TARGET_FPA"
  3132.   "*
  3133. {
  3134.   if (rtx_equal_p (operands[1], operands[2]))
  3135.     return \"fpsqr%.d %y1,%0\";
  3136.   if (rtx_equal_p (operands[0], operands[1]))
  3137.     return \"fpmul%.d %y2,%0\";
  3138.   if (rtx_equal_p (operands[0], operands[2]))
  3139.     return \"fpmul%.d %y1,%0\";
  3140.   if (which_alternative == 0)
  3141.     return \"fpmul3%.d %w2,%w1,%0\";
  3142.   return \"fpmul3%.d %x2,%x1,%0\";
  3143. }")
  3144.  
  3145. (define_insn ""
  3146.   [(set (match_operand:DF 0 "general_operand" "=f")
  3147.     (mult:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
  3148.          (match_operand:DF 1 "general_operand" "0")))]
  3149.   "TARGET_68881"
  3150.   "f%&mul%.l %2,%0")
  3151.  
  3152. (define_insn ""
  3153.   [(set (match_operand:DF 0 "general_operand" "=f")
  3154.     (mult:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
  3155.          (match_operand:DF 1 "general_operand" "0")))]
  3156.   "TARGET_68881"
  3157.   "f%&mul%.w %2,%0")
  3158.  
  3159. (define_insn ""
  3160.   [(set (match_operand:DF 0 "general_operand" "=f")
  3161.     (mult:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
  3162.          (match_operand:DF 1 "general_operand" "0")))]
  3163.   "TARGET_68881"
  3164.   "f%&mul%.b %2,%0")
  3165.  
  3166. (define_insn ""
  3167.   [(set (match_operand:DF 0 "general_operand" "=f")
  3168.     (mult:DF (match_operand:DF 1 "general_operand" "%0")
  3169.          (match_operand:DF 2 "general_operand" "fmG")))]
  3170.   "TARGET_68881"
  3171.   "*
  3172. {
  3173.   if (GET_CODE (operands[2]) == CONST_DOUBLE
  3174.       && floating_exact_log2 (operands[2]) && !TARGET_68040)
  3175.     {
  3176.       int i = floating_exact_log2 (operands[2]);
  3177.       operands[2] = gen_rtx (CONST_INT, VOIDmode, i);
  3178.       return \"fscale%.l %2,%0\";
  3179.     }
  3180.   if (REG_P (operands[2]))
  3181.     return \"f%&mul%.x %2,%0\";
  3182.   return \"f%&mul%.d %f2,%0\";
  3183. }")
  3184.  
  3185. (define_expand "mulsf3"
  3186.   [(set (match_operand:SF 0 "general_operand" "")
  3187.     (mult:SF (match_operand:SF 1 "general_operand" "")
  3188.          (match_operand:SF 2 "general_operand" "")))]
  3189.   "TARGET_68881 || TARGET_FPA"
  3190.   "")
  3191.  
  3192. (define_insn ""
  3193.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  3194.     (mult:SF (match_operand:SF 1 "general_operand" "%xH,y")
  3195.          (match_operand:SF 2 "general_operand" "xH,rmF")))]
  3196.   "TARGET_FPA"
  3197.   "*
  3198. {
  3199.   if (rtx_equal_p (operands[1], operands[2]))
  3200.     return \"fpsqr%.s %w1,%0\";
  3201.   if (rtx_equal_p (operands[0], operands[1]))
  3202.     return \"fpmul%.s %w2,%0\";
  3203.   if (rtx_equal_p (operands[0], operands[2]))
  3204.     return \"fpmul%.s %w1,%0\";
  3205.   if (which_alternative == 0)
  3206.     return \"fpmul3%.s %w2,%w1,%0\";
  3207.   return \"fpmul3%.s %2,%1,%0\";
  3208. }")
  3209.  
  3210. (define_insn ""
  3211.   [(set (match_operand:SF 0 "general_operand" "=f")
  3212.     (mult:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
  3213.          (match_operand:SF 1 "general_operand" "0")))]
  3214.   "TARGET_68881"
  3215.   "*
  3216. {
  3217.   return (TARGET_68040_ONLY
  3218.           ? \"fsmul%.l %2,%0\"
  3219.           : \"fsglmul%.l %2,%0\");
  3220. }")
  3221.  
  3222. (define_insn ""
  3223.   [(set (match_operand:SF 0 "general_operand" "=f")
  3224.     (mult:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
  3225.          (match_operand:SF 1 "general_operand" "0")))]
  3226.   "TARGET_68881"
  3227.   "*
  3228. {
  3229.   return (TARGET_68040_ONLY
  3230.           ? \"fsmul%.w %2,%0\"
  3231.           : \"fsglmul%.w %2,%0\");
  3232. }")
  3233.  
  3234. (define_insn ""
  3235.   [(set (match_operand:SF 0 "general_operand" "=f")
  3236.     (mult:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
  3237.          (match_operand:SF 1 "general_operand" "0")))]
  3238.   "TARGET_68881"
  3239.   "*
  3240. {
  3241.   return (TARGET_68040_ONLY
  3242.           ? \"fsmul%.b %2,%0\"
  3243.           : \"fsglmul%.b %2,%0\");
  3244. }")
  3245.  
  3246. (define_insn ""
  3247.   [(set (match_operand:SF 0 "general_operand" "=f")
  3248.     (mult:SF (match_operand:SF 1 "general_operand" "%0")
  3249.          (match_operand:SF 2 "general_operand" "fdmF")))]
  3250.   "TARGET_68881"
  3251.   "*
  3252. {
  3253. #ifdef FSGLMUL_USE_S
  3254.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  3255.     return (TARGET_68040_ONLY
  3256.         ? \"fsmul%.s %2,%0\"
  3257.         : \"fsglmul%.s %2,%0\");
  3258. #else
  3259.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  3260.     return (TARGET_68040_ONLY
  3261.         ? \"fsmul%.x %2,%0\"
  3262.         : \"fsglmul%.x %2,%0\");
  3263. #endif
  3264.   return (TARGET_68040_ONLY
  3265.       ? \"fsmul%.s %f2,%0\"
  3266.       : \"fsglmul%.s %f2,%0\");
  3267. }")
  3268.  
  3269. ;; divide instructions
  3270.  
  3271. (define_expand "divdf3"
  3272.   [(set (match_operand:DF 0 "general_operand" "")
  3273.     (div:DF (match_operand:DF 1 "general_operand" "")
  3274.         (match_operand:DF 2 "general_operand" "")))]
  3275.   "TARGET_68881 || TARGET_FPA"
  3276.   "")
  3277.  
  3278. (define_insn ""
  3279.   [(set (match_operand:DF 0 "general_operand" "=x,y,y")
  3280.     (div:DF (match_operand:DF 1 "general_operand" "xH,y,rmF")
  3281.         (match_operand:DF 2 "general_operand" "xH,rmF,0")))]
  3282.   "TARGET_FPA"
  3283.   "*
  3284. {
  3285.   if (rtx_equal_p (operands[0], operands[2]))
  3286.     return \"fprdiv%.d %y1,%0\";
  3287.   if (rtx_equal_p (operands[0], operands[1]))
  3288.     return \"fpdiv%.d %y2,%0\";
  3289.   if (which_alternative == 0)
  3290.     return \"fpdiv3%.d %w2,%w1,%0\";
  3291.   return \"fpdiv3%.d %x2,%x1,%x0\";
  3292. }")
  3293.  
  3294. (define_insn ""
  3295.   [(set (match_operand:DF 0 "general_operand" "=f")
  3296.     (div:DF (match_operand:DF 1 "general_operand" "0")
  3297.         (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
  3298.   "TARGET_68881"
  3299.   "f%&div%.l %2,%0")
  3300.  
  3301. (define_insn ""
  3302.   [(set (match_operand:DF 0 "general_operand" "=f")
  3303.     (div:DF (match_operand:DF 1 "general_operand" "0")
  3304.         (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
  3305.   "TARGET_68881"
  3306.   "f%&div%.w %2,%0")
  3307.  
  3308. (define_insn ""
  3309.   [(set (match_operand:DF 0 "general_operand" "=f")
  3310.     (div:DF (match_operand:DF 1 "general_operand" "0")
  3311.         (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
  3312.   "TARGET_68881"
  3313.   "f%&div%.b %2,%0")
  3314.  
  3315. (define_insn ""
  3316.   [(set (match_operand:DF 0 "general_operand" "=f")
  3317.     (div:DF (match_operand:DF 1 "general_operand" "0")
  3318.         (match_operand:DF 2 "general_operand" "fmG")))]
  3319.   "TARGET_68881"
  3320.   "*
  3321. {
  3322.   if (REG_P (operands[2]))
  3323.     return \"f%&div%.x %2,%0\";
  3324.   return \"f%&div%.d %f2,%0\";
  3325. }")
  3326.  
  3327. (define_expand "divsf3"
  3328.   [(set (match_operand:SF 0 "general_operand" "")
  3329.     (div:SF (match_operand:SF 1 "general_operand" "")
  3330.         (match_operand:SF 2 "general_operand" "")))]
  3331.   "TARGET_68881 || TARGET_FPA"
  3332.   "")
  3333.  
  3334. (define_insn ""
  3335.   [(set (match_operand:SF 0 "general_operand" "=x,y,y")
  3336.     (div:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
  3337.         (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
  3338.   "TARGET_FPA"
  3339.   "*
  3340. {
  3341.   if (rtx_equal_p (operands[0], operands[1]))
  3342.     return \"fpdiv%.s %w2,%0\";
  3343.   if (rtx_equal_p (operands[0], operands[2]))
  3344.     return \"fprdiv%.s %w1,%0\";
  3345.   if (which_alternative == 0)
  3346.     return \"fpdiv3%.s %w2,%w1,%0\";
  3347.   return \"fpdiv3%.s %2,%1,%0\";
  3348. }")
  3349.  
  3350. (define_insn ""
  3351.   [(set (match_operand:SF 0 "general_operand" "=f")
  3352.     (div:SF (match_operand:SF 1 "general_operand" "0")
  3353.         (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
  3354.   "TARGET_68881"
  3355.   "*
  3356. {
  3357.   return (TARGET_68040_ONLY
  3358.           ? \"fsdiv%.l %2,%0\"
  3359.           : \"fsgldiv%.l %2,%0\");
  3360. }")
  3361.  
  3362. (define_insn ""
  3363.   [(set (match_operand:SF 0 "general_operand" "=f")
  3364.     (div:SF (match_operand:SF 1 "general_operand" "0")
  3365.         (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
  3366.   "TARGET_68881"
  3367.   "*
  3368. {
  3369.   return (TARGET_68040_ONLY
  3370.           ? \"fsdiv%.w %2,%0\"
  3371.           : \"fsgldiv%.w %2,%0\");
  3372. }")
  3373.  
  3374. (define_insn ""
  3375.   [(set (match_operand:SF 0 "general_operand" "=f")
  3376.     (div:SF (match_operand:SF 1 "general_operand" "0")
  3377.         (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
  3378.   "TARGET_68881"
  3379.   "*
  3380. {
  3381.   return (TARGET_68040_ONLY
  3382.           ? \"fsdiv%.b %2,%0\"
  3383.           : \"fsgldiv%.b %2,%0\");
  3384. }")
  3385.  
  3386. (define_insn ""
  3387.   [(set (match_operand:SF 0 "general_operand" "=f")
  3388.     (div:SF (match_operand:SF 1 "general_operand" "0")
  3389.         (match_operand:SF 2 "general_operand" "fdmF")))]
  3390.   "TARGET_68881"
  3391.   "*
  3392. {
  3393. #ifdef FSGLDIV_USE_S
  3394.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  3395.     return (TARGET_68040_ONLY
  3396.         ? \"fsdiv%.s %2,%0\"
  3397.         : \"fsgldiv%.s %2,%0\");
  3398. #else
  3399.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  3400.     return (TARGET_68040_ONLY
  3401.         ? \"fsdiv%.x %2,%0\"
  3402.         : \"fsgldiv%.x %2,%0\");
  3403. #endif
  3404.   return (TARGET_68040_ONLY
  3405.       ? \"fsdiv%.s %f2,%0\"
  3406.       : \"fsgldiv%.s %f2,%0\");
  3407. }")
  3408.  
  3409. ;; Remainder instructions.
  3410.  
  3411. (define_insn "divmodsi4"
  3412.   [(set (match_operand:SI 0 "general_operand" "=d")
  3413.     (div:SI (match_operand:SI 1 "general_operand" "0")
  3414.         (match_operand:SI 2 "general_operand" "dmsK")))
  3415.    (set (match_operand:SI 3 "general_operand" "=d")
  3416.     (mod:SI (match_dup 1) (match_dup 2)))]
  3417.   "TARGET_68020"
  3418.   "*
  3419. {
  3420.   if (find_reg_note (insn, REG_UNUSED, operands[3]))
  3421.     return \"divs%.l %2,%0\";
  3422.   else
  3423.     return \"divsl%.l %2,%3:%0\";
  3424. }")
  3425.  
  3426. (define_insn "udivmodsi4"
  3427.   [(set (match_operand:SI 0 "general_operand" "=d")
  3428.     (udiv:SI (match_operand:SI 1 "general_operand" "0")
  3429.          (match_operand:SI 2 "general_operand" "dmsK")))
  3430.    (set (match_operand:SI 3 "general_operand" "=d")
  3431.     (umod:SI (match_dup 1) (match_dup 2)))]
  3432.   "TARGET_68020"
  3433.   "*
  3434. {
  3435.   if (find_reg_note (insn, REG_UNUSED, operands[3]))
  3436.     return \"divu%.l %2,%0\";
  3437.   else
  3438.     return \"divul%.l %2,%3:%0\";
  3439. }")
  3440.  
  3441. (define_insn "divmodhi4"
  3442.   [(set (match_operand:HI 0 "general_operand" "=d")
  3443.     (div:HI (match_operand:HI 1 "general_operand" "0")
  3444.         (match_operand:HI 2 "general_operand" "dmsK")))
  3445.    (set (match_operand:HI 3 "general_operand" "=d")
  3446.     (mod:HI (match_dup 1) (match_dup 2)))]
  3447.   ""
  3448.   "*
  3449. {
  3450. #ifdef MOTOROLA
  3451.   output_asm_insn(\"ext%.l %0\;divs%.w %2,%0\", operands);
  3452. #else
  3453.   output_asm_insn(\"extl %0\;divs %2,%0\", operands);
  3454. #endif
  3455.   if (!find_reg_note(insn, REG_UNUSED, operands[3]))
  3456.     {
  3457.       CC_STATUS_INIT;
  3458.       return \"move%.l %0,%3\;swap %3\";
  3459.     }
  3460.   else
  3461.     return \"\";
  3462. }")
  3463.  
  3464. (define_insn "udivmodhi4"
  3465.   [(set (match_operand:HI 0 "general_operand" "=d")
  3466.     (udiv:HI (match_operand:HI 1 "general_operand" "0")
  3467.          (match_operand:HI 2 "general_operand" "dmsK")))
  3468.    (set (match_operand:HI 3 "general_operand" "=d")
  3469.     (umod:HI (match_dup 1) (match_dup 2)))]
  3470.   ""
  3471.   "*
  3472. {
  3473. #ifdef MOTOROLA
  3474.   output_asm_insn(\"and%.l %#0xFFFF,%0\;divu%.w %2,%0\", operands);
  3475. #else
  3476.   output_asm_insn(\"and%.l %#0xFFFF,%0\;divu %2,%0\", operands);
  3477. #endif
  3478.   if (!find_reg_note(insn, REG_UNUSED, operands[3]))
  3479.     {
  3480.       CC_STATUS_INIT;
  3481.       return \"move%.l %0,%3\;swap %3\";
  3482.     }
  3483.   else
  3484.     return \"\";
  3485. }")
  3486.  
  3487. ;; logical-and instructions
  3488.  
  3489. ;; Prevent AND from being made with sp.  This doesn't exist in the machine
  3490. ;; and reload will cause inefficient code.  Since sp is a FIXED_REG, we
  3491. ;; can't allocate pseudos into it.
  3492. (define_insn "andsi3"
  3493.   [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
  3494.     (and:SI (match_operand:SI 1 "general_operand" "%0,0")
  3495.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  3496.   ""
  3497.   "*
  3498. {
  3499.   int logval;
  3500.   if (GET_CODE (operands[2]) == CONST_INT
  3501.       && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
  3502.       && (DATA_REG_P (operands[0])
  3503.       || offsettable_memref_p (operands[0])))
  3504.     { 
  3505.       if (GET_CODE (operands[0]) != REG)
  3506.         operands[0] = adj_offsettable_operand (operands[0], 2);
  3507.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  3508.                  INTVAL (operands[2]) & 0xffff);
  3509.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  3510.       CC_STATUS_INIT;
  3511.       if (operands[2] == const0_rtx)
  3512.         return \"clr%.w %0\";
  3513.       return \"and%.w %2,%0\";
  3514.     }
  3515.   if (GET_CODE (operands[2]) == CONST_INT
  3516.       && (logval = exact_log2 (~ INTVAL (operands[2]))) >= 0
  3517.       && (DATA_REG_P (operands[0])
  3518.           || offsettable_memref_p (operands[0])))
  3519.     { 
  3520.       if (DATA_REG_P (operands[0]))
  3521.         {
  3522.           operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
  3523.         }
  3524.       else
  3525.         {
  3526.       operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
  3527.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
  3528.         }
  3529.       /* This does not set condition codes in a standard way.  */
  3530.       CC_STATUS_INIT;
  3531.       return \"bclr %1,%0\";
  3532.     }
  3533.   return \"and%.l %2,%0\";
  3534. }")
  3535.  
  3536. (define_insn "andhi3"
  3537.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  3538.     (and:HI (match_operand:HI 1 "general_operand" "%0,0")
  3539.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  3540.   ""
  3541.   "and%.w %2,%0")
  3542.  
  3543. (define_insn ""
  3544.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3545.     (and:HI (match_dup 0)
  3546.         (match_operand:HI 1 "general_operand" "dn,dmn")))]
  3547.   ""
  3548.   "and%.w %1,%0")
  3549.  
  3550. (define_insn ""
  3551.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3552.     (and:HI (match_operand:HI 1 "general_operand" "dn,dmn")
  3553.         (match_dup 0)))]
  3554.   ""
  3555.   "and%.w %1,%0")
  3556.  
  3557. (define_insn "andqi3"
  3558.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  3559.     (and:QI (match_operand:QI 1 "general_operand" "%0,0")
  3560.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  3561.   ""
  3562.   "and%.b %2,%0")
  3563.  
  3564. (define_insn ""
  3565.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3566.     (and:QI (match_dup 0)
  3567.         (match_operand:QI 1 "general_operand" "dn,dmn")))]
  3568.   ""
  3569.   "and%.b %1,%0")
  3570.  
  3571. (define_insn ""
  3572.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3573.     (and:QI (match_operand:QI 1 "general_operand" "dn,dmn")
  3574.         (match_dup 0)))]
  3575.   ""
  3576.   "and%.b %1,%0")
  3577.  
  3578. ;; inclusive-or instructions
  3579.  
  3580. (define_insn "iorsi3"
  3581.   [(set (match_operand:SI 0 "general_operand" "=m,d")
  3582.     (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
  3583.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  3584.   ""
  3585.   "*
  3586. {
  3587.   register int logval;
  3588.   if (GET_CODE (operands[2]) == CONST_INT
  3589.       && INTVAL (operands[2]) >> 16 == 0
  3590.       && (DATA_REG_P (operands[0])
  3591.       || offsettable_memref_p (operands[0])))
  3592.     { 
  3593.       if (GET_CODE (operands[0]) != REG)
  3594.         operands[0] = adj_offsettable_operand (operands[0], 2);
  3595.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  3596.       CC_STATUS_INIT;
  3597.       return \"or%.w %2,%0\";
  3598.     }
  3599.   if (GET_CODE (operands[2]) == CONST_INT
  3600.       && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
  3601.       && (DATA_REG_P (operands[0])
  3602.       || offsettable_memref_p (operands[0])))
  3603.     { 
  3604.       if (DATA_REG_P (operands[0]))
  3605.     {
  3606.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
  3607.     }
  3608.       else
  3609.         {
  3610.       operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
  3611.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
  3612.     }
  3613.       CC_STATUS_INIT;
  3614.       return \"bset %1,%0\";
  3615.     }
  3616.   return \"or%.l %2,%0\";
  3617. }")
  3618.  
  3619. (define_insn "iorhi3"
  3620.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  3621.     (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
  3622.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  3623.   ""
  3624.   "or%.w %2,%0")
  3625.  
  3626. (define_insn ""
  3627.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3628.     (ior:HI (match_dup 0)
  3629.         (match_operand:HI 1 "general_operand" "dn,dmn")))]
  3630.   ""
  3631.   "or%.w %1,%0")
  3632.  
  3633. (define_insn ""
  3634.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  3635.     (ior:HI (match_operand:HI 1 "general_operand" "dn,dmn")
  3636.         (match_dup 0)))]
  3637.   ""
  3638.   "or%.w %1,%0")
  3639.  
  3640. (define_insn "iorqi3"
  3641.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  3642.     (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
  3643.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  3644.   ""
  3645.   "or%.b %2,%0")
  3646.  
  3647. (define_insn ""
  3648.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3649.     (ior:QI (match_dup 0)
  3650.         (match_operand:QI 1 "general_operand" "dn,dmn")))]
  3651.   ""
  3652.   "or%.b %1,%0")
  3653.  
  3654. (define_insn ""
  3655.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  3656.     (ior:QI (match_operand:QI 1 "general_operand" "dn,dmn")
  3657.         (match_dup 0)))]
  3658.   ""
  3659.   "or%.b %1,%0")
  3660.  
  3661. (define_insn ""
  3662.   [(set (match_operand:SI 0 "general_operand" "=o,d")
  3663.     (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
  3664.         (match_operand:SI 2 "general_operand" "0,0")))]
  3665.   ""
  3666.   "*
  3667. {
  3668.   int byte_mode;
  3669.  
  3670.   CC_STATUS_INIT;
  3671.   byte_mode = (GET_MODE(operands[1]) == QImode);
  3672.   if (GET_CODE (operands[0]) == MEM)
  3673.     operands[0] = adj_offsettable_operand (operands[0], byte_mode ? 3 : 2);
  3674.   if (byte_mode)
  3675.     return \"or%.b %1,%0\";
  3676.   else
  3677.     return \"or%.w %1,%0\";
  3678. }")
  3679.  
  3680. ;; xor instructions
  3681.  
  3682. (define_insn "xorsi3"
  3683.   [(set (match_operand:SI 0 "general_operand" "=do,m")
  3684.     (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
  3685.         (match_operand:SI 2 "general_operand" "di,dKs")))]
  3686.   ""
  3687.   "*
  3688. {
  3689.   if (GET_CODE (operands[2]) == CONST_INT
  3690.       && INTVAL (operands[2]) >> 16 == 0
  3691.       && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0])))
  3692.     { 
  3693.       if (! DATA_REG_P (operands[0]))
  3694.     operands[0] = adj_offsettable_operand (operands[0], 2);
  3695.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  3696.       CC_STATUS_INIT;
  3697.       return \"eor%.w %2,%0\";
  3698.     }
  3699.   return \"eor%.l %2,%0\";
  3700. }")
  3701.  
  3702. (define_insn "xorhi3"
  3703.   [(set (match_operand:HI 0 "general_operand" "=dm")
  3704.     (xor:HI (match_operand:HI 1 "general_operand" "%0")
  3705.         (match_operand:HI 2 "general_operand" "dn")))]
  3706.   ""
  3707.   "eor%.w %2,%0")
  3708.  
  3709. (define_insn ""
  3710.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  3711.     (xor:HI (match_dup 0)
  3712.         (match_operand:HI 1 "general_operand" "dn")))]
  3713.   ""
  3714.   "eor%.w %1,%0")
  3715.  
  3716.  
  3717. (define_insn ""
  3718.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  3719.     (xor:HI (match_operand:HI 1 "general_operand" "dn")
  3720.         (match_dup 0)))]
  3721.   ""
  3722.   "eor%.w %1,%0")
  3723.  
  3724. (define_insn "xorqi3"
  3725.   [(set (match_operand:QI 0 "general_operand" "=dm")
  3726.     (xor:QI (match_operand:QI 1 "general_operand" "%0")
  3727.         (match_operand:QI 2 "general_operand" "dn")))]
  3728.   ""
  3729.   "eor%.b %2,%0")
  3730.  
  3731. (define_insn ""
  3732.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  3733.     (xor:QI (match_dup 0)
  3734.         (match_operand:QI 1 "general_operand" "dn")))]
  3735.   ""
  3736.   "eor%.b %1,%0")
  3737.  
  3738. (define_insn ""
  3739.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  3740.     (xor:QI (match_operand:QI 1 "general_operand" "dn")
  3741.         (match_dup 0)))]
  3742.   ""
  3743.   "eor%.b %1,%0")
  3744.  
  3745. ;; negation instructions
  3746.  
  3747. (define_insn "negdi2"
  3748.   [(set (match_operand:DI 0 "general_operand" "=d*ao,<")
  3749.     (neg:DI (match_operand:DI 1 "general_operand" "0,0")))]
  3750.   ""
  3751.   "*
  3752. {
  3753.   if (which_alternative == 1)
  3754.     return \"neg%.l %0\;negx%.l %0\";
  3755.   if (GET_CODE (operands[0]) == REG)
  3756.     operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  3757.   else
  3758.     operands[1] = adj_offsettable_operand (operands[0], 4);
  3759.   if (ADDRESS_REG_P (operands[0]))
  3760.     return \"exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0\";
  3761.   else
  3762.     return \"neg%.l %1\;negx%.l %0\";
  3763. } ")
  3764.  
  3765. (define_insn "negsi2"
  3766.   [(set (match_operand:SI 0 "general_operand" "=dm")
  3767.     (neg:SI (match_operand:SI 1 "general_operand" "0")))]
  3768.   ""
  3769.   "neg%.l %0")
  3770.  
  3771. (define_insn "neghi2"
  3772.   [(set (match_operand:HI 0 "general_operand" "=dm")
  3773.     (neg:HI (match_operand:HI 1 "general_operand" "0")))]
  3774.   ""
  3775.   "neg%.w %0")
  3776.  
  3777. (define_insn ""
  3778.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  3779.     (neg:HI (match_dup 0)))]
  3780.   ""
  3781.   "neg%.w %0")
  3782.  
  3783. (define_insn "negqi2"
  3784.   [(set (match_operand:QI 0 "general_operand" "=dm")
  3785.     (neg:QI (match_operand:QI 1 "general_operand" "0")))]
  3786.   ""
  3787.   "neg%.b %0")
  3788.  
  3789. (define_insn ""
  3790.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  3791.     (neg:QI (match_dup 0)))]
  3792.   ""
  3793.   "neg%.b %0")
  3794.  
  3795. ;; If using software floating point, just flip the sign bit.
  3796.  
  3797. (define_expand "negsf2"
  3798.   [(set (match_operand:SF 0 "general_operand" "")
  3799.     (neg:SF (match_operand:SF 1 "general_operand" "")))]
  3800.   ""
  3801.   "
  3802. {
  3803.   if (!TARGET_FPA && !TARGET_68881)
  3804.     {
  3805.       rtx result;
  3806.       rtx target;
  3807.  
  3808.       target = operand_subword_force (operands[0], 0, SFmode);
  3809.       result = expand_binop (SImode, xor_optab,
  3810.                  operand_subword_force (operands[1], 0, SFmode),
  3811.                  GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
  3812.       if (result == 0)
  3813.     abort ();
  3814.  
  3815.       if (result != target)
  3816.     emit_move_insn (result, target);
  3817.  
  3818.       /* Make a place for REG_EQUAL.  */
  3819.       emit_move_insn (operands[0], operands[0]);
  3820.       DONE;
  3821.     }
  3822. }")
  3823.  
  3824. (define_insn ""
  3825.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  3826.     (neg:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
  3827.   "TARGET_FPA"
  3828.   "fpneg%.s %w1,%0")
  3829.  
  3830. (define_insn ""
  3831.   [(set (match_operand:SF 0 "general_operand" "=f,d")
  3832.     (neg:SF (match_operand:SF 1 "general_operand" "fdmF,0")))]
  3833.   "TARGET_68881"
  3834.   "*
  3835. {
  3836.   if (DATA_REG_P (operands[0]))
  3837.     {
  3838.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 31);
  3839.       return \"bchg %1,%0\";
  3840.     }
  3841.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  3842.     return \"f%$neg%.x %1,%0\";
  3843.   return \"f%$neg%.s %f1,%0\";
  3844. }")
  3845.  
  3846. (define_expand "negdf2"
  3847.   [(set (match_operand:DF 0 "general_operand" "")
  3848.     (neg:DF (match_operand:DF 1 "general_operand" "")))]
  3849.   ""
  3850.   "
  3851. {
  3852.   if (!TARGET_FPA && !TARGET_68881)
  3853.     {
  3854.       rtx result;
  3855.       rtx target;
  3856.       rtx insns;
  3857.  
  3858.       start_sequence ();
  3859.       target = operand_subword (operands[0], 0, 1, DFmode);
  3860.       result = expand_binop (SImode, xor_optab,
  3861.                  operand_subword_force (operands[1], 0, DFmode),
  3862.                  GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
  3863.       if (result == 0)
  3864.     abort ();
  3865.  
  3866.       if (result != target)
  3867.     emit_move_insn (result, target);
  3868.   
  3869.       emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
  3870.               operand_subword_force (operands[1], 1, DFmode));
  3871.  
  3872.       insns = get_insns ();
  3873.       end_sequence ();
  3874.  
  3875.       emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
  3876.       DONE;
  3877.     }
  3878. }")
  3879.  
  3880. (define_insn ""
  3881.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  3882.     (neg:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
  3883.   "TARGET_FPA"
  3884.   "fpneg%.d %y1, %0")
  3885.  
  3886. (define_insn ""
  3887.   [(set (match_operand:DF 0 "general_operand" "=f,d")
  3888.     (neg:DF (match_operand:DF 1 "general_operand" "fmF,0")))]
  3889.   "TARGET_68881"
  3890.   "*
  3891. {
  3892.   if (DATA_REG_P (operands[0]))
  3893.     {
  3894.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 31);
  3895.       return \"bchg %1,%0\";
  3896.     }
  3897.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  3898.     return \"f%&neg%.x %1,%0\";
  3899.   return \"f%&neg%.d %f1,%0\";
  3900. }")
  3901.  
  3902. ;; Sqrt instruction for the 68881
  3903.  
  3904. (define_insn "sqrtsf2"
  3905.   [(set (match_operand:SF 0 "general_operand" "=f")
  3906.     (sqrt:SF (match_operand:SF 1 "general_operand" "fm")))]
  3907.   "TARGET_68881"
  3908.   "*
  3909. {
  3910.   if (FP_REG_P (operands[1]))
  3911.     return \"f%$sqrt%.x %1,%0\";
  3912.   else
  3913.     return \"f%$sqrt%.s %1,%0\";
  3914. }")
  3915.  
  3916. (define_insn "sqrtdf2"
  3917.   [(set (match_operand:DF 0 "general_operand" "=f")
  3918.     (sqrt:DF (match_operand:DF 1 "general_operand" "fm")))]
  3919.   "TARGET_68881"
  3920.   "*
  3921. {
  3922.   if (FP_REG_P (operands[1]))
  3923.     return \"f%&sqrt%.x %1,%0\";
  3924.   else
  3925.     return \"f%&sqrt%.d %1,%0\";
  3926. }")
  3927.  
  3928. ;; Absolute value instructions
  3929. ;; If using software floating point, just zero the sign bit.
  3930.  
  3931. (define_expand "abssf2"
  3932.   [(set (match_operand:SF 0 "general_operand" "")
  3933.     (abs:SF (match_operand:SF 1 "general_operand" "")))]
  3934.   ""
  3935.   "
  3936. {
  3937.   if (!TARGET_FPA && !TARGET_68881)
  3938.     {
  3939.       rtx result;
  3940.       rtx target;
  3941.  
  3942.       target = operand_subword_force (operands[0], 0, SFmode);
  3943.       result = expand_binop (SImode, and_optab,
  3944.                  operand_subword_force (operands[1], 0, SFmode),
  3945.                  GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN);
  3946.       if (result == 0)
  3947.     abort ();
  3948.  
  3949.       if (result != target)
  3950.     emit_move_insn (result, target);
  3951.  
  3952.       /* Make a place for REG_EQUAL.  */
  3953.       emit_move_insn (operands[0], operands[0]);
  3954.       DONE;
  3955.     }
  3956. }")
  3957.  
  3958. (define_insn ""
  3959.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  3960.     (abs:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
  3961.   "TARGET_FPA"
  3962.   "fpabs%.s %y1,%0")
  3963.  
  3964. (define_insn ""
  3965.   [(set (match_operand:SF 0 "general_operand" "=f")
  3966.     (abs:SF (match_operand:SF 1 "general_operand" "fdmF")))]
  3967.   "TARGET_68881"
  3968.   "*
  3969. {
  3970.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  3971.     return \"f%$abs%.x %1,%0\";
  3972.   return \"f%$abs%.s %f1,%0\";
  3973. }")
  3974.  
  3975. (define_expand "absdf2"
  3976.   [(set (match_operand:DF 0 "general_operand" "")
  3977.     (abs:DF (match_operand:DF 1 "general_operand" "")))]
  3978.   ""
  3979.   "
  3980. {
  3981.   if (!TARGET_FPA && !TARGET_68881)
  3982.     {
  3983.       rtx result;
  3984.       rtx target;
  3985.       rtx insns;
  3986.  
  3987.       start_sequence ();
  3988.       target = operand_subword (operands[0], 0, 1, DFmode);
  3989.       result = expand_binop (SImode, and_optab,
  3990.                  operand_subword_force (operands[1], 0, DFmode),
  3991.                  GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN);
  3992.       if (result == 0)
  3993.     abort ();
  3994.  
  3995.       if (result != target)
  3996.     emit_move_insn (result, target);
  3997.   
  3998.       emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
  3999.               operand_subword_force (operands[1], 1, DFmode));
  4000.  
  4001.       insns = get_insns ();
  4002.       end_sequence ();
  4003.  
  4004.       emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
  4005.       DONE;
  4006.     }
  4007. }")
  4008.  
  4009. (define_insn ""
  4010.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  4011.     (abs:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
  4012.   "TARGET_FPA"
  4013.   "fpabs%.d %y1,%0")
  4014.  
  4015. (define_insn ""
  4016.   [(set (match_operand:DF 0 "general_operand" "=f")
  4017.     (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
  4018.   "TARGET_68881"
  4019.   "*
  4020. {
  4021.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  4022.     return \"f%&abs%.x %1,%0\";
  4023.   return \"f%&abs%.d %f1,%0\";
  4024. }")
  4025.  
  4026. ;; one complement instructions
  4027.  
  4028. ;; "one_cmpldi2" is only here to help combine().
  4029. (define_insn "one_cmpldi2"
  4030.   [(set (match_operand:DI 0 "general_operand" "=dm")
  4031.     (not:DI (match_operand:DI 1 "general_operand" "0")))]
  4032.   ""
  4033.   "*
  4034. {
  4035.   CC_STATUS_INIT;
  4036.   if (GET_CODE (operands[0]) == REG)
  4037.     operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4038.   else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
  4039.         || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  4040.     operands[1] = operands[0];
  4041.   else
  4042.     operands[1] = adj_offsettable_operand (operands[0], 4);
  4043.   return \"not%.l %1\;not%.l %0\";
  4044. }")
  4045.  
  4046. (define_insn "one_cmplsi2"
  4047.   [(set (match_operand:SI 0 "general_operand" "=dm")
  4048.     (not:SI (match_operand:SI 1 "general_operand" "0")))]
  4049.   ""
  4050.   "not%.l %0")
  4051.  
  4052. (define_insn "one_cmplhi2"
  4053.   [(set (match_operand:HI 0 "general_operand" "=dm")
  4054.     (not:HI (match_operand:HI 1 "general_operand" "0")))]
  4055.   ""
  4056.   "not%.w %0")
  4057.  
  4058. (define_insn ""
  4059.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  4060.     (not:HI (match_dup 0)))]
  4061.   ""
  4062.   "not%.w %0")
  4063.  
  4064. (define_insn "one_cmplqi2"
  4065.   [(set (match_operand:QI 0 "general_operand" "=dm")
  4066.     (not:QI (match_operand:QI 1 "general_operand" "0")))]
  4067.   ""
  4068.   "not%.b %0")
  4069.  
  4070. (define_insn ""
  4071.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  4072.     (not:QI (match_dup 0)))]
  4073.   ""
  4074.   "not%.b %0")
  4075.  
  4076. ;; arithmetic shift instructions
  4077. ;; We don't need the shift memory by 1 bit instruction
  4078.  
  4079. (define_insn "ashldi_extsi"
  4080.   [(set (match_operand:DI 0 "general_operand" "=ro")
  4081.     (ashift:DI
  4082.       (match_operator:DI 2 "extend_operator"
  4083.         [(match_operand:SI 1 "general_operand" "rm")])
  4084.       (const_int 32)))]
  4085.   ""
  4086.   "*
  4087. {
  4088.   CC_STATUS_INIT;
  4089.   if (GET_CODE (operands[0]) == REG)
  4090.     operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4091.   else
  4092.     operands[2] = adj_offsettable_operand (operands[0], 4);
  4093.   if (ADDRESS_REG_P (operands[0]))
  4094.     return \"move%.l %1,%0\;sub%.l %2,%2\";
  4095.   else
  4096.     return \"move%.l %1,%0\;clr%.l %2\";
  4097. } ")
  4098.  
  4099. (define_insn "ashldi_sexthi"
  4100.   [(set (match_operand:DI 0 "register_operand" "=*da")
  4101.     (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm"))
  4102.         (const_int 32)))]
  4103.   ""
  4104.   "*
  4105. {
  4106.   CC_STATUS_INIT;
  4107.   operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4108.   if (DATA_REG_P (operands[0]))
  4109.     return \"move%.w %1,%0\;ext%.l %0\;clr%.l %2\";
  4110.   else
  4111.     return \"move%.w %1,%0\;sub%.l %2,%2\";
  4112. } ")
  4113.  
  4114. (define_insn "ashldi_const32"
  4115.   [(set (match_operand:DI 0 "general_operand" "=ro,<,>")
  4116.     (ashift:DI (match_operand:DI 1 "general_operand" "ro,ro,ro")
  4117.              (const_int 32)))]
  4118.   ""
  4119.   "*
  4120. {
  4121.   CC_STATUS_INIT;
  4122.   if (GET_CODE (operands[1]) == REG)
  4123.     operands[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  4124.   else
  4125.     operands[3] = adj_offsettable_operand (operands[1], 4);
  4126.   if (which_alternative == 1)
  4127.     return \"clr%.l %0\;move%.l %3,%0\";
  4128.   if (which_alternative == 2)
  4129.     return \"move%.l %3,%0\;clr%.l %0\";
  4130.   if (GET_CODE (operands[0]) == REG)
  4131.     operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4132.   else
  4133.     operands[2] = adj_offsettable_operand (operands[0], 4);
  4134.   if (ADDRESS_REG_P (operands[2]))
  4135.     return \"move%.l %3,%0\;sub%.l %2,%2\";
  4136.   else
  4137.     return \"move%.l %3,%0\;clr%.l %2\";
  4138. } ")
  4139.  
  4140. ;; The predicate below must be general_operand, because ashldi3 allows that
  4141. (define_insn "ashldi_const"
  4142.   [(set (match_operand:DI 0 "general_operand" "=d")
  4143.     (ashift:DI (match_operand:DI 1 "general_operand" "0")
  4144.              (match_operand 2 "const_int_operand" "n")))]
  4145.   "(INTVAL (operands[2]) == 1
  4146.     || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
  4147.    || INTVAL (operands[2]) == 2 || INTVAL (operands[2]) == 3)"
  4148.   "*
  4149. {
  4150.   operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4151.   if (INTVAL (operands[2]) == 1)
  4152.     return \"add%.l %1,%1\;addx%.l %0,%0\";
  4153.   else if (INTVAL (operands[2]) == 8)
  4154.     return \"rol%.l %#8,%1\;rol%.l %#8,%0\;move%.b %1,%0\;clr%.b %1\";
  4155.   else if (INTVAL (operands[2]) == 16)
  4156.     return \"swap %1\;swap %0\;move%.w %1,%0\;clr%.w %1\";
  4157.   else if (INTVAL (operands[2]) == 2)
  4158.     return \"add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\";
  4159.   else/* if (INTVAL (operands[2]) == 3)*/
  4160.     return \"add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\";
  4161. } ")
  4162.  
  4163. (define_expand "ashldi3"
  4164.   [(set (match_operand:DI 0 "general_operand" "")
  4165.     (ashift:DI (match_operand:DI 1 "general_operand" "")
  4166.              (match_operand 2 "const_int_operand" "")))]
  4167.   ""
  4168.   "
  4169. {
  4170.   if (GET_CODE (operands[2]) != CONST_INT
  4171.   || (INTVAL (operands[2]) != 1 && INTVAL (operands[2]) != 32
  4172.      && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
  4173.      && INTVAL (operands[2]) != 2 && INTVAL (operands[2]) != 3))
  4174.     FAIL;
  4175. } ")
  4176.  
  4177. ;; On all 68k models, this makes faster code in a special case.
  4178.  
  4179. (define_insn ""
  4180.   [(set (match_operand:SI 0 "register_operand" "=d")
  4181.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  4182.            (const_int 16)))]
  4183.   ""
  4184.   "*
  4185. {
  4186.   CC_STATUS_INIT;
  4187.   return \"swap %0\;clr%.w %0\";
  4188. }")
  4189.  
  4190. ;; On the 68000, this makes faster code in a special case.
  4191.  
  4192. (define_insn ""
  4193.   [(set (match_operand:SI 0 "register_operand" "=d")
  4194.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  4195.            (match_operand:SI 2 "const_int_operand" "n")))]
  4196.   "(! TARGET_68020
  4197.     && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
  4198.   "*
  4199. {
  4200.   CC_STATUS_INIT;
  4201.  
  4202.   operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
  4203.   return \"asl%.w %2,%0\;swap %0\;clr%.w %0\";
  4204. }")
  4205.  
  4206. (define_insn "ashlsi3"
  4207.   [(set (match_operand:SI 0 "register_operand" "=d")
  4208.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  4209.            (match_operand:SI 2 "general_operand" "dI")))]
  4210.   ""
  4211.   "*
  4212. {
  4213.   if (operands[2] == const1_rtx)
  4214.     return \"add%.l %0,%0\";
  4215.   return \"asl%.l %2,%0\";
  4216. }")
  4217.  
  4218. (define_insn "ashlhi3"
  4219.   [(set (match_operand:HI 0 "register_operand" "=d")
  4220.     (ashift:HI (match_operand:HI 1 "register_operand" "0")
  4221.            (match_operand:HI 2 "general_operand" "dI")))]
  4222.   ""
  4223.   "asl%.w %2,%0")
  4224.  
  4225. (define_insn ""
  4226.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  4227.     (ashift:HI (match_dup 0)
  4228.            (match_operand:HI 1 "general_operand" "dI")))]
  4229.   ""
  4230.   "asl%.w %1,%0")
  4231.  
  4232. (define_insn "ashlqi3"
  4233.   [(set (match_operand:QI 0 "register_operand" "=d")
  4234.     (ashift:QI (match_operand:QI 1 "register_operand" "0")
  4235.            (match_operand:QI 2 "general_operand" "dI")))]
  4236.   ""
  4237.   "asl%.b %2,%0")
  4238.  
  4239. (define_insn ""
  4240.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  4241.     (ashift:QI (match_dup 0)
  4242.            (match_operand:QI 1 "general_operand" "dI")))]
  4243.   ""
  4244.   "asl%.b %1,%0")
  4245.  
  4246. ;; On all 68k models, this makes faster code in a special case.
  4247.  
  4248. (define_insn ""
  4249.   [(set (match_operand:SI 0 "register_operand" "=d")
  4250.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
  4251.              (const_int 16)))]
  4252.   ""
  4253.   "swap %0\;ext%.l %0")
  4254.  
  4255. ;; On the 68000, this makes faster code in a special case.
  4256.  
  4257. (define_insn ""
  4258.   [(set (match_operand:SI 0 "register_operand" "=d")
  4259.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
  4260.              (match_operand:SI 2 "const_int_operand" "n")))]
  4261.   "(! TARGET_68020
  4262.     && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
  4263.   "*
  4264. {
  4265.   operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
  4266.   return \"swap %0\;asr%.w %2,%0\;ext%.l %0\";
  4267. }")
  4268.  
  4269. (define_insn "subreghi1ashrdi_const32"
  4270.   [(set (match_operand:HI 0 "general_operand" "=rm")
  4271.     (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
  4272.             (const_int 32)) 1))]
  4273.   ""
  4274.   "*
  4275. {
  4276.   if (GET_CODE (operands[1]) != REG)
  4277.     operands[1] = adj_offsettable_operand (operands[1], 2);
  4278.   return \"move%.w %1,%0\";
  4279. } ")
  4280.  
  4281. (define_insn "subregsi1ashrdi_const32"
  4282.   [(set (match_operand:SI 0 "general_operand" "=rm")
  4283.     (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
  4284.             (const_int 32)) 1))]
  4285.   ""
  4286.   "*
  4287. {
  4288.   return \"move%.l %1,%0\";
  4289. } ")
  4290.  
  4291. (define_insn "ashrdi_const32"
  4292.   [(set (match_operand:DI 0 "register_operand" "=d")
  4293.     (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
  4294.              (const_int 32)))]
  4295.   ""
  4296.   "*
  4297. {
  4298.   CC_STATUS_INIT;
  4299.   operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4300.   if (TARGET_68020)
  4301.     return \"move%.l %1,%2\;smi %0\;extb%.l %0\";
  4302.   else
  4303.     return \"move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0\";
  4304. } ")
  4305.  
  4306. (define_insn "ashrdi_const32_mem"
  4307.   [(set (match_operand:DI 0 "general_operand" "=o,<")
  4308.     (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro")
  4309.              (const_int 32)))
  4310.    (clobber (match_scratch:SI 2 "=d,d"))]
  4311.   ""
  4312.   "*
  4313. {
  4314.   CC_STATUS_INIT;
  4315.   if (which_alternative == 1)
  4316.     operands[3] = operands[0];
  4317.   else
  4318.     operands[3] = adj_offsettable_operand (operands[0], 4);
  4319.   if (TARGET_68020)
  4320.     return \"move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0\";
  4321.   else
  4322.     return \"move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\";
  4323. } ")
  4324.  
  4325. ;; The predicate below must be general_operand, because ashrdi3 allows that
  4326. (define_insn "ashrdi_const"
  4327.   [(set (match_operand:DI 0 "general_operand" "=d")
  4328.     (ashiftrt:DI (match_operand:DI 1 "general_operand" "0")
  4329.              (match_operand 2 "const_int_operand" "n")))]
  4330.   "(INTVAL (operands[2]) == 1 || INTVAL (operands[2]) == 2
  4331.     || INTVAL (operands[2]) == 3 || INTVAL (operands[2]) == 8
  4332.     || INTVAL (operands[2]) == 16 || INTVAL (operands[2]) == 63)"
  4333.   "*
  4334. {
  4335.   operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4336.   if (INTVAL (operands[2]) == 63)
  4337.     return \"add%.l %0,%0\;subx%.l %0,%0\;move%.l %0,%1\";
  4338.   CC_STATUS_INIT;
  4339.   if (INTVAL (operands[2]) == 1)
  4340.     return \"asr%.l %#1,%0\;roxr%.l %#1,%1\";
  4341.   else if (INTVAL (operands[2]) == 8)
  4342.     return \"move%.b %0,%1\;asr%.l %#8,%0\;ror%.l %#8,%1\";
  4343.   else if (INTVAL (operands[2]) == 16)
  4344.     return \"move%.w %0,%1\;clr%.w %0\;swap %1\;ext%.l %0\";
  4345.   else if (INTVAL (operands[2]) == 2)
  4346.     return \"asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\";
  4347.   else/* if (INTVAL (operands[2]) == 3)*/
  4348.     return \"asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\";
  4349. } ")
  4350.  
  4351. (define_expand "ashrdi3"
  4352.   [(set (match_operand:DI 0 "general_operand" "")
  4353.     (ashiftrt:DI (match_operand:DI 1 "general_operand" "")
  4354.              (match_operand 2 "const_int_operand" "")))]
  4355.   ""
  4356.   "
  4357. {
  4358.   if (GET_CODE (operands[2]) != CONST_INT
  4359.   || (INTVAL (operands[2]) != 1 && INTVAL (operands[2]) != 2
  4360.      && INTVAL (operands[2]) != 3 && INTVAL (operands[2]) != 8
  4361.      && INTVAL (operands[2]) != 16 && INTVAL (operands[2]) != 32
  4362.      && INTVAL (operands[2]) != 63))
  4363.     FAIL;
  4364. } ")
  4365.  
  4366. (define_insn "ashrsi3"
  4367.   [(set (match_operand:SI 0 "register_operand" "=d")
  4368.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
  4369.              (match_operand:SI 2 "general_operand" "dI")))]
  4370.   ""
  4371.   "asr%.l %2,%0")
  4372.  
  4373. (define_insn "ashrhi3"
  4374.   [(set (match_operand:HI 0 "register_operand" "=d")
  4375.     (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
  4376.              (match_operand:HI 2 "general_operand" "dI")))]
  4377.   ""
  4378.   "asr%.w %2,%0")
  4379.  
  4380. (define_insn ""
  4381.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  4382.     (ashiftrt:HI (match_dup 0)
  4383.              (match_operand:HI 1 "general_operand" "dI")))]
  4384.   ""
  4385.   "asr%.w %1,%0")
  4386.  
  4387. (define_insn "ashrqi3"
  4388.   [(set (match_operand:QI 0 "register_operand" "=d")
  4389.     (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
  4390.              (match_operand:QI 2 "general_operand" "dI")))]
  4391.   ""
  4392.   "asr%.b %2,%0")
  4393.  
  4394. (define_insn ""
  4395.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  4396.     (ashiftrt:QI (match_dup 0)
  4397.              (match_operand:QI 1 "general_operand" "dI")))]
  4398.   ""
  4399.   "asr%.b %1,%0")
  4400.  
  4401. ;; logical shift instructions
  4402.  
  4403. (define_insn ""
  4404.         [(set (cc0)
  4405.             (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
  4406.                     (const_int 32)) 1))
  4407.         (set (match_operand:SI 1 "general_operand" "=dm")
  4408.             (subreg:SI (lshiftrt:DI (match_operand:DI 2 "general_operand" "0")
  4409.                     (const_int 32)) 1))]
  4410.   ""
  4411.   "*
  4412. {
  4413.   return \"move%.l %0,%1\";
  4414. } ")
  4415.  
  4416. (define_insn ""
  4417.         [(set (cc0)
  4418.             (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
  4419.                     (const_int 32)) 0))
  4420.         (set (match_operand:DI 1 "general_operand" "=do")
  4421.             (lshiftrt:DI (match_operand:DI 2 "general_operand" "0")
  4422.                 (const_int 32)))]
  4423.   ""
  4424.   "*
  4425. {
  4426.   if (GET_CODE (operands[1]) == REG)
  4427.     operands[2] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  4428.   else
  4429.     operands[2] = adj_offsettable_operand (operands[1], 4);
  4430.   return \"move%.l %0,%2\;clr%.l %1\";
  4431. } ")
  4432.  
  4433. (define_insn "subreg1lshrdi_const32"
  4434.   [(set (match_operand:SI 0 "general_operand" "=rm")
  4435.     (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
  4436.             (const_int 32)) 1))]
  4437.   ""
  4438.   "*
  4439. {
  4440.   return \"move%.l %1,%0\";
  4441. } ")
  4442.  
  4443. (define_insn "lshrdi_const32"
  4444.   [(set (match_operand:DI 0 "general_operand" "=ro,<,>")
  4445.     (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro,ro")
  4446.              (const_int 32)))]
  4447.   ""
  4448.   "*
  4449. {
  4450.   CC_STATUS_INIT;
  4451.   if (which_alternative == 1)
  4452.     return \"move%.l %1,%0\;clr%.l %0\";
  4453.   if (which_alternative == 2)
  4454.     return \"clr%.l %0\;move%.l %1,%0\";
  4455.   if (GET_CODE (operands[0]) == REG)
  4456.     operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4457.   else
  4458.     operands[2] = adj_offsettable_operand (operands[0], 4);
  4459.   if (GET_CODE (operands[1]) == REG)
  4460.     operands[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  4461.   else
  4462.     operands[3] = adj_offsettable_operand (operands[1], 4);
  4463.   if (ADDRESS_REG_P (operands[0]))
  4464.     return \"move%.l %1,%2\;sub%.l %0,%0\";
  4465.   else
  4466.     return \"move%.l %1,%2\;clr%.l %0\";
  4467. } ")
  4468.  
  4469. ;; The predicate below must be general_operand, because lshrdi3 allows that
  4470. (define_insn "lshrdi_const"
  4471.   [(set (match_operand:DI 0 "general_operand" "=d")
  4472.     (lshiftrt:DI (match_operand:DI 1 "general_operand" "0")
  4473.              (match_operand 2 "const_int_operand" "n")))]
  4474.   "(INTVAL (operands[2]) == 1 || INTVAL (operands[2]) == 2
  4475.     || INTVAL (operands[2]) == 3 || INTVAL (operands[2]) == 8
  4476.     || INTVAL (operands[2]) == 16 || INTVAL (operands[2]) == 63)"
  4477.   "*
  4478. {
  4479.   operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  4480.   if (INTVAL (operands[2]) == 63)
  4481.     return \"add%.l %0,%0\;clr%.l %0\;clr%.l %1\;addx%.l %1,%1\";
  4482.   CC_STATUS_INIT;
  4483.   if (INTVAL (operands[2]) == 1)
  4484.     return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\";
  4485.   else if (INTVAL (operands[2]) == 8)
  4486.     return \"move%.b %0,%1\;lsr%.l %#8,%0\;ror%.l %#8,%1\";
  4487.   else if (INTVAL (operands[2]) == 16)
  4488.     return \"move%.w %0,%1\;clr%.w %0\;swap %1\;swap %0\";
  4489.   else if (INTVAL (operands[2]) == 2)
  4490.     return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\";
  4491.   else /*if (INTVAL (operands[2]) == 3)*/
  4492.     return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\";
  4493. } ")
  4494.  
  4495. (define_expand "lshrdi3"
  4496.   [(set (match_operand:DI 0 "general_operand" "")
  4497.     (lshiftrt:DI (match_operand:DI 1 "general_operand" "")
  4498.              (match_operand 2 "const_int_operand" "")))]
  4499.   ""
  4500.   "
  4501. {
  4502.   if (GET_CODE (operands[2]) != CONST_INT
  4503.   || (INTVAL (operands[2]) != 1 && INTVAL (operands[2]) != 2
  4504.      && INTVAL (operands[2]) != 3 && INTVAL (operands[2]) != 8
  4505.      && INTVAL (operands[2]) != 16 && INTVAL (operands[2]) != 32
  4506.      && INTVAL (operands[2]) != 63))
  4507.     FAIL;
  4508. } ")
  4509.  
  4510. ;; On all 68k models, this makes faster code in a special case.
  4511.  
  4512. (define_insn "lshrsi_31"
  4513.   [(set (match_operand:SI 0 "register_operand" "=d")
  4514.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  4515.              (const_int 31)))]
  4516.   ""
  4517.   "*
  4518. {
  4519.   return \"add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0\";
  4520. }")
  4521.  
  4522. ;; On all 68k models, this makes faster code in a special case.
  4523.  
  4524. (define_insn "lshrsi_16"
  4525.   [(set (match_operand:SI 0 "register_operand" "=d")
  4526.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  4527.              (const_int 16)))]
  4528.   ""
  4529.   "*
  4530. {
  4531.   CC_STATUS_INIT;
  4532.   return \"clr%.w %0\;swap %0\";
  4533. }")
  4534.  
  4535. ;; On the 68000, this makes faster code in a special case.
  4536.  
  4537. (define_insn "lshrsi_17_24"
  4538.   [(set (match_operand:SI 0 "register_operand" "=d")
  4539.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  4540.              (match_operand:SI 2 "const_int_operand" "n")))]
  4541.   "(! TARGET_68020
  4542.     && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
  4543.   "*
  4544. {
  4545.   /* I think lsr%.w sets the CC properly.  */
  4546.   operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
  4547.   return \"clr%.w %0\;swap %0\;lsr%.w %2,%0\";
  4548. }")
  4549.  
  4550. (define_insn "lshrsi3"
  4551.   [(set (match_operand:SI 0 "register_operand" "=d")
  4552.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  4553.              (match_operand:SI 2 "general_operand" "dI")))]
  4554.   ""
  4555.   "lsr%.l %2,%0")
  4556.  
  4557. (define_insn "lshrhi3"
  4558.   [(set (match_operand:HI 0 "register_operand" "=d")
  4559.     (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
  4560.              (match_operand:HI 2 "general_operand" "dI")))]
  4561.   ""
  4562.   "lsr%.w %2,%0")
  4563.  
  4564. (define_insn ""
  4565.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  4566.     (lshiftrt:HI (match_dup 0)
  4567.              (match_operand:HI 1 "general_operand" "dI")))]
  4568.   ""
  4569.   "lsr%.w %1,%0")
  4570.  
  4571. (define_insn "lshrqi3"
  4572.   [(set (match_operand:QI 0 "register_operand" "=d")
  4573.     (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
  4574.              (match_operand:QI 2 "general_operand" "dI")))]
  4575.   ""
  4576.   "lsr%.b %2,%0")
  4577.  
  4578. (define_insn ""
  4579.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  4580.     (lshiftrt:QI (match_dup 0)
  4581.              (match_operand:QI 1 "general_operand" "dI")))]
  4582.   ""
  4583.   "lsr%.b %1,%0")
  4584.  
  4585. ;; rotate instructions
  4586.  
  4587. (define_insn "rotlsi3"
  4588.   [(set (match_operand:SI 0 "register_operand" "=d")
  4589.     (rotate:SI (match_operand:SI 1 "register_operand" "0")
  4590.            (match_operand:SI 2 "general_operand" "dI")))]
  4591.   ""
  4592.   "rol%.l %2,%0")
  4593.  
  4594. (define_insn "rotlhi3"
  4595.   [(set (match_operand:HI 0 "register_operand" "=d")
  4596.     (rotate:HI (match_operand:HI 1 "register_operand" "0")
  4597.            (match_operand:HI 2 "general_operand" "dI")))]
  4598.   ""
  4599.   "rol%.w %2,%0")
  4600.  
  4601.  
  4602. (define_insn ""
  4603.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  4604.     (rotate:HI (match_dup 0)
  4605.            (match_operand:HI 1 "general_operand" "dI")))]
  4606.   ""
  4607.   "rol%.w %1,%0")
  4608.  
  4609. (define_insn "rotlqi3"
  4610.   [(set (match_operand:QI 0 "register_operand" "=d")
  4611.     (rotate:QI (match_operand:QI 1 "register_operand" "0")
  4612.            (match_operand:QI 2 "general_operand" "dI")))]
  4613.   ""
  4614.   "rol%.b %2,%0")
  4615.  
  4616. (define_insn ""
  4617.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  4618.     (rotate:QI (match_dup 0)
  4619.            (match_operand:QI 1 "general_operand" "dI")))]
  4620.   ""
  4621.   "rol%.b %1,%0")
  4622.  
  4623. (define_insn "rotrsi3"
  4624.   [(set (match_operand:SI 0 "register_operand" "=d")
  4625.     (rotatert:SI (match_operand:SI 1 "register_operand" "0")
  4626.              (match_operand:SI 2 "general_operand" "dI")))]
  4627.   ""
  4628.   "ror%.l %2,%0")
  4629.  
  4630. (define_insn "rotrhi3"
  4631.   [(set (match_operand:HI 0 "register_operand" "=d")
  4632.     (rotatert:HI (match_operand:HI 1 "register_operand" "0")
  4633.              (match_operand:HI 2 "general_operand" "dI")))]
  4634.   ""
  4635.   "ror%.w %2,%0")
  4636.  
  4637. (define_insn ""
  4638.   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
  4639.     (rotatert:HI (match_dup 0)
  4640.              (match_operand:HI 1 "general_operand" "dI")))]
  4641.   ""
  4642.   "ror%.w %1,%0")
  4643.  
  4644. (define_insn "rotrqi3"
  4645.   [(set (match_operand:QI 0 "register_operand" "=d")
  4646.     (rotatert:QI (match_operand:QI 1 "register_operand" "0")
  4647.              (match_operand:QI 2 "general_operand" "dI")))]
  4648.   ""
  4649.   "ror%.b %2,%0")
  4650.  
  4651. (define_insn ""
  4652.   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
  4653.     (rotatert:QI (match_dup 0)
  4654.              (match_operand:QI 1 "general_operand" "dI")))]
  4655.   ""
  4656.   "ror%.b %1,%0")
  4657.  
  4658.  
  4659. ;; Bit set/clear in memory byte.
  4660.  
  4661. ;; set bit, bit number is int
  4662. (define_insn "bsetmemqi"
  4663.   [(set (match_operand:QI 0 "memory_operand" "+m")
  4664.     (ior:QI (subreg:QI (ashift:SI (const_int 1)
  4665.         (match_operand:SI 1 "general_operand" "d")) 0)
  4666.     (match_dup 0)))]
  4667.   ""
  4668.   "*
  4669. {
  4670.   CC_STATUS_INIT;
  4671.   return \"bset %1,%0\";
  4672. }")
  4673.  
  4674. ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
  4675. (define_insn ""
  4676.   [(set (match_operand:QI 0 "memory_operand" "+m")
  4677.     (ior:QI (subreg:QI (ashift:SI (const_int 1)
  4678.         (match_operator:SI 2 "extend_operator"
  4679.         [(match_operand 1 "general_operand" "d")])) 0)
  4680.     (match_dup 0)))]
  4681.   ""
  4682.   "*
  4683. {
  4684.   CC_STATUS_INIT;
  4685.   return \"bset %1,%0\";
  4686. }")
  4687.  
  4688. ;; clear bit, bit number is int
  4689. (define_insn "bclrmemqi"
  4690.   [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
  4691.     (const_int 1)
  4692.     (minus:SI (const_int 7)
  4693.         (match_operand:SI 1 "general_operand" "d")))
  4694.     (const_int 0))]
  4695.   ""
  4696.   "*
  4697. {
  4698.   CC_STATUS_INIT;
  4699.   return \"bclr %1,%0\";
  4700. }")
  4701.  
  4702. ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
  4703. (define_insn ""
  4704.   [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
  4705.     (const_int 1)
  4706.     (minus:SI (const_int 7)
  4707.         (match_operator:SI 2 "extend_operator"
  4708.         [(match_operand 1 "general_operand" "d")])))
  4709.     (const_int 0))]
  4710.   ""
  4711.   "*
  4712. {
  4713.   CC_STATUS_INIT;
  4714.   return \"bclr %1,%0\";
  4715. }")
  4716.  
  4717. ;; Special cases of bit-field insns which we should
  4718. ;; recognize in preference to the general case.
  4719. ;; These handle aligned 8-bit and 16-bit fields,
  4720. ;; which can usually be done with move instructions.
  4721.  
  4722. ;
  4723. ; Special case for 32-bit field in memory.  This only occurs when 32-bit
  4724. ; alignment of structure members is specified.
  4725. ;
  4726. ; The move is allowed to be odd byte aligned, because that's still faster
  4727. ; than an odd byte aligned bit field instruction.
  4728. ;
  4729. (define_insn ""
  4730.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o")
  4731.              (const_int 32)
  4732.              (match_operand:SI 2 "const_int_operand" "n"))
  4733.     (match_operand:SI 3 "general_operand" "rmi"))]
  4734.   "TARGET_68020 && TARGET_BITFIELD
  4735.    && (INTVAL (operands[2]) % 8) == 0
  4736.    && ! mode_dependent_address_p (XEXP (operands[0], 0))"
  4737.   "*
  4738. {
  4739.   operands[0]
  4740.     = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
  4741.  
  4742.   return \"move%.l %3,%0\";
  4743. }")
  4744.  
  4745. (define_insn ""
  4746.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+do")
  4747.              (match_operand:SI 1 "const_int_operand" "n")
  4748.              (match_operand:SI 2 "const_int_operand" "n"))
  4749.     (match_operand:SI 3 "register_operand" "d"))]
  4750.   "TARGET_68020 && TARGET_BITFIELD
  4751.    && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
  4752.    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
  4753.    && (GET_CODE (operands[0]) == REG
  4754.        || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
  4755.   "*
  4756. {
  4757.   if (REG_P (operands[0]))
  4758.     {
  4759.       if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
  4760.         return \"bfins %3,%0{%b2:%b1}\";
  4761.     }
  4762.   else
  4763.     operands[0]
  4764.       = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
  4765.  
  4766.   if (GET_CODE (operands[3]) == MEM)
  4767.     operands[3] = adj_offsettable_operand (operands[3],
  4768.                        (32 - INTVAL (operands[1])) / 8);
  4769.   if (INTVAL (operands[1]) == 8)
  4770.     return \"move%.b %3,%0\";
  4771.   return \"move%.w %3,%0\";
  4772. }")
  4773.  
  4774.  
  4775. ;
  4776. ; Special case for 32-bit field in memory.  This only occurs when 32-bit
  4777. ; alignment of structure members is specified.
  4778. ;
  4779. ; The move is allowed to be odd byte aligned, because that's still faster
  4780. ; than an odd byte aligned bit field instruction.
  4781. ;
  4782. (define_insn ""
  4783.   [(set (match_operand:SI 0 "general_operand" "=rm")
  4784.     (zero_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o")
  4785.              (const_int 32)
  4786.              (match_operand:SI 3 "const_int_operand" "n")))]
  4787.   "TARGET_68020 && TARGET_BITFIELD
  4788.    && (INTVAL (operands[3]) % 8) == 0
  4789.    && ! mode_dependent_address_p (XEXP (operands[1], 0))"
  4790.   "*
  4791. {
  4792.   operands[1]
  4793.     = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  4794.  
  4795.   return \"move%.l %1,%0\";
  4796. }")
  4797.  
  4798. (define_insn ""
  4799.   [(set (match_operand:SI 0 "general_operand" "=&d")
  4800.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  4801.              (match_operand:SI 2 "const_int_operand" "n")
  4802.              (match_operand:SI 3 "const_int_operand" "n")))]
  4803.   "TARGET_68020 && TARGET_BITFIELD
  4804.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  4805.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  4806.    && (GET_CODE (operands[1]) == REG
  4807.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  4808.   "*
  4809. {
  4810.   cc_status.flags |= CC_NOT_NEGATIVE;
  4811.   if (REG_P (operands[1]))
  4812.     {
  4813.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  4814.     return \"bfextu %1{%b3:%b2},%0\";
  4815.     }
  4816.   else
  4817.     operands[1]
  4818.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  4819.  
  4820.   output_asm_insn (\"clr%.l %0\", operands);
  4821.   if (GET_CODE (operands[0]) == MEM)
  4822.     operands[0] = adj_offsettable_operand (operands[0],
  4823.                        (32 - INTVAL (operands[1])) / 8);
  4824.   if (INTVAL (operands[2]) == 8)
  4825.     return \"move%.b %1,%0\";
  4826.   return \"move%.w %1,%0\";
  4827. }")
  4828.  
  4829. ;
  4830. ; Special case for 32-bit field in memory.  This only occurs when 32-bit
  4831. ; alignment of structure members is specified.
  4832. ;
  4833. ; The move is allowed to be odd byte aligned, because that's still faster
  4834. ; than an odd byte aligned bit field instruction.
  4835. ;
  4836. (define_insn ""
  4837.   [(set (match_operand:SI 0 "general_operand" "=rm")
  4838.     (sign_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o")
  4839.              (const_int 32)
  4840.              (match_operand:SI 3 "const_int_operand" "n")))]
  4841.   "TARGET_68020 && TARGET_BITFIELD
  4842.    && (INTVAL (operands[3]) % 8) == 0
  4843.    && ! mode_dependent_address_p (XEXP (operands[1], 0))"
  4844.   "*
  4845. {
  4846.   operands[1]
  4847.     = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  4848.  
  4849.   return \"move%.l %1,%0\";
  4850. }")
  4851.  
  4852. (define_insn ""
  4853.   [(set (match_operand:SI 0 "general_operand" "=d")
  4854.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  4855.              (match_operand:SI 2 "const_int_operand" "n")
  4856.              (match_operand:SI 3 "const_int_operand" "n")))]
  4857.   "TARGET_68020 && TARGET_BITFIELD
  4858.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  4859.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  4860.    && (GET_CODE (operands[1]) == REG
  4861.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  4862.   "*
  4863. {
  4864.   if (REG_P (operands[1]))
  4865.     {
  4866.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  4867.     return \"bfexts %1{%b3:%b2},%0\";
  4868.     }
  4869.   else
  4870.     operands[1]
  4871.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  4872.  
  4873.   if (INTVAL (operands[2]) == 8)
  4874.     return \"move%.b %1,%0\;extb%.l %0\";
  4875.   return \"move%.w %1,%0\;ext%.l %0\";
  4876. }")
  4877.  
  4878. ;; Bit field instructions, general cases.
  4879. ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
  4880. ;; so that its address is reloaded.
  4881.  
  4882. (define_insn "extv"
  4883.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  4884.     (sign_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  4885.              (match_operand:SI 2 "general_operand" "di,di")
  4886.              (match_operand:SI 3 "general_operand" "di,di")))]
  4887.   "TARGET_68020 && TARGET_BITFIELD"
  4888.   "bfexts %1{%b3:%b2},%0")
  4889.  
  4890. (define_insn "extzv"
  4891.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  4892.     (zero_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  4893.              (match_operand:SI 2 "general_operand" "di,di")
  4894.              (match_operand:SI 3 "general_operand" "di,di")))]
  4895.   "TARGET_68020 && TARGET_BITFIELD"
  4896.   "*
  4897. {
  4898.   if (GET_CODE (operands[2]) == CONST_INT)
  4899.     {
  4900.       if (INTVAL (operands[2]) != 32)
  4901.     cc_status.flags |= CC_NOT_NEGATIVE;
  4902.     }
  4903.   else
  4904.     {
  4905.       CC_STATUS_INIT;
  4906.     }
  4907.   return \"bfextu %1{%b3:%b2},%0\";
  4908. }")
  4909.  
  4910. (define_insn ""
  4911.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  4912.              (match_operand:SI 1 "general_operand" "di,di")
  4913.              (match_operand:SI 2 "general_operand" "di,di"))
  4914.         (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
  4915.         (match_operand 3 "const_int_operand" "n,n")))]
  4916.   "TARGET_68020 && TARGET_BITFIELD
  4917.    && (INTVAL (operands[3]) == -1
  4918.        || (GET_CODE (operands[1]) == CONST_INT
  4919.            && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
  4920.   "*
  4921. {
  4922.   CC_STATUS_INIT;
  4923.   return \"bfchg %0{%b2:%b1}\";
  4924. }")
  4925.  
  4926. (define_insn ""
  4927.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  4928.              (match_operand:SI 1 "general_operand" "di,di")
  4929.              (match_operand:SI 2 "general_operand" "di,di"))
  4930.     (const_int 0))]
  4931.   "TARGET_68020 && TARGET_BITFIELD"
  4932.   "*
  4933. {
  4934.   CC_STATUS_INIT;
  4935.   return \"bfclr %0{%b2:%b1}\";
  4936. }")
  4937.  
  4938. (define_insn ""
  4939.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  4940.              (match_operand:SI 1 "general_operand" "di,di")
  4941.              (match_operand:SI 2 "general_operand" "di,di"))
  4942.     (const_int -1))]
  4943.   "TARGET_68020 && TARGET_BITFIELD"
  4944.   "*
  4945. {
  4946.   CC_STATUS_INIT;
  4947.   return \"bfset %0{%b2:%b1}\";
  4948. }")
  4949.  
  4950. (define_insn "insv"
  4951.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  4952.              (match_operand:SI 1 "general_operand" "di,di")
  4953.              (match_operand:SI 2 "general_operand" "di,di"))
  4954.     (match_operand:SI 3 "register_operand" "d,d"))]
  4955.   "TARGET_68020 && TARGET_BITFIELD"
  4956.   "bfins %3,%0{%b2:%b1}")
  4957.  
  4958. ;; Now recognize bit field insns that operate on registers
  4959. ;; (or at least were intended to do so).
  4960.  
  4961. (define_insn ""
  4962.   [(set (match_operand:SI 0 "general_operand" "=d")
  4963.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  4964.              (match_operand:SI 2 "general_operand" "di")
  4965.              (match_operand:SI 3 "general_operand" "di")))]
  4966.   "TARGET_68020 && TARGET_BITFIELD"
  4967.   "bfexts %1{%b3:%b2},%0")
  4968.  
  4969. (define_insn ""
  4970.   [(set (match_operand:SI 0 "general_operand" "=d")
  4971.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  4972.              (match_operand:SI 2 "general_operand" "di")
  4973.              (match_operand:SI 3 "general_operand" "di")))]
  4974.   "TARGET_68020 && TARGET_BITFIELD"
  4975.   "*
  4976. {
  4977.   if (GET_CODE (operands[2]) == CONST_INT)
  4978.     {
  4979.       if (INTVAL (operands[2]) != 32)
  4980.     cc_status.flags |= CC_NOT_NEGATIVE;
  4981.     }
  4982.   else
  4983.     {
  4984.       CC_STATUS_INIT;
  4985.     }
  4986.   return \"bfextu %1{%b3:%b2},%0\";
  4987. }")
  4988.  
  4989. (define_insn ""
  4990.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  4991.              (match_operand:SI 1 "general_operand" "di")
  4992.              (match_operand:SI 2 "general_operand" "di"))
  4993.     (const_int 0))]
  4994.   "TARGET_68020 && TARGET_BITFIELD"
  4995.   "*
  4996. {
  4997.   CC_STATUS_INIT;
  4998.   return \"bfclr %0{%b2:%b1}\";
  4999. }")
  5000.  
  5001. (define_insn ""
  5002.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  5003.              (match_operand:SI 1 "general_operand" "di")
  5004.              (match_operand:SI 2 "general_operand" "di"))
  5005.     (const_int -1))]
  5006.   "TARGET_68020 && TARGET_BITFIELD"
  5007.   "*
  5008. {
  5009.   CC_STATUS_INIT;
  5010.   return \"bfset %0{%b2:%b1}\";
  5011. }")
  5012.  
  5013. (define_insn ""
  5014.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  5015.              (match_operand:SI 1 "general_operand" "di")
  5016.              (match_operand:SI 2 "general_operand" "di"))
  5017.     (match_operand:SI 3 "register_operand" "d"))]
  5018.   "TARGET_68020 && TARGET_BITFIELD"
  5019.   "*
  5020. {
  5021. #if 0
  5022.   /* These special cases are now recognized by a specific pattern.  */
  5023.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  5024.       && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
  5025.     return \"move%.w %3,%0\";
  5026.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  5027.       && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
  5028.     return \"move%.b %3,%0\";
  5029. #endif
  5030.   return \"bfins %3,%0{%b2:%b1}\";
  5031. }")
  5032.  
  5033. ;; Special patterns for optimizing bit-field instructions.
  5034.  
  5035. (define_insn ""
  5036.   [(set (cc0)
  5037.     (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  5038.              (match_operand:SI 1 "const_int_operand" "n")
  5039.              (match_operand:SI 2 "general_operand" "di")))]
  5040.   "TARGET_68020 && TARGET_BITFIELD"
  5041.   "*
  5042. {
  5043.   if (operands[1] == const1_rtx
  5044.       && GET_CODE (operands[2]) == CONST_INT)
  5045.     {    
  5046.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  5047.       return output_btst (operands,
  5048.               gen_rtx (CONST_INT, VOIDmode,
  5049.                    width - INTVAL (operands[2])),
  5050.               operands[0],
  5051.               insn, 1000);
  5052.       /* Pass 1000 as SIGNPOS argument so that btst will
  5053.          not think we are testing the sign bit for an `and'
  5054.      and assume that nonzero implies a negative result.  */
  5055.     }
  5056.   if (INTVAL (operands[1]) != 32)
  5057.     cc_status.flags = CC_NOT_NEGATIVE;
  5058.   return \"bftst %0{%b2:%b1}\";
  5059. }")
  5060.  
  5061.   
  5062. ;;; now handle the register cases
  5063. (define_insn ""
  5064.   [(set (cc0)
  5065.     (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  5066.              (match_operand:SI 1 "const_int_operand" "n")
  5067.              (match_operand:SI 2 "general_operand" "di")))]
  5068.   "TARGET_68020 && TARGET_BITFIELD"
  5069.   "*
  5070. {
  5071.   if (operands[1] == const1_rtx
  5072.       && GET_CODE (operands[2]) == CONST_INT)
  5073.     {    
  5074.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  5075.       return output_btst (operands,
  5076.               gen_rtx (CONST_INT, VOIDmode,
  5077.                    width - INTVAL (operands[2])),
  5078.               operands[0],
  5079.               insn, 1000);
  5080.       /* Pass 1000 as SIGNPOS argument so that btst will
  5081.          not think we are testing the sign bit for an `and'
  5082.      and assume that nonzero implies a negative result.  */
  5083.     }
  5084.   if (INTVAL (operands[1]) != 32)
  5085.     cc_status.flags = CC_NOT_NEGATIVE;
  5086.   return \"bftst %0{%b2:%b1}\";
  5087. }")
  5088.  
  5089. (define_insn "scc0_di"
  5090.   [(set (match_operand:QI 0 "general_operand" "=dm")
  5091.     (match_operator 1 "valid_dbcc_comparison_p"
  5092.       [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
  5093.   ""
  5094.   "*
  5095. {
  5096.   return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
  5097. } ")
  5098.  
  5099. (define_insn "scc_di"
  5100.   [(set (match_operand:QI 0 "general_operand" "=dm,dm")
  5101.     (match_operator 1 "valid_dbcc_comparison_p"
  5102.       [(match_operand:DI 2 "general_operand" "ro,r")
  5103.        (match_operand:DI 3 "general_operand" "r,ro")]))]
  5104.   ""
  5105.   "*
  5106. {
  5107.   return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
  5108. } ")
  5109.  
  5110. (define_insn "seq"
  5111.   [(set (match_operand:QI 0 "general_operand" "=d")
  5112.     (eq:QI (cc0) (const_int 0)))]
  5113.   ""
  5114.   "*
  5115.   cc_status = cc_prev_status;
  5116.   OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
  5117. ")
  5118.  
  5119. (define_insn "sne"
  5120.   [(set (match_operand:QI 0 "general_operand" "=d")
  5121.     (ne:QI (cc0) (const_int 0)))]
  5122.   ""
  5123.   "*
  5124.   cc_status = cc_prev_status;
  5125.   OUTPUT_JUMP (\"sne %0\", \"fsne %0\", \"sne %0\");
  5126. ")
  5127.  
  5128. (define_insn "sgt"
  5129.   [(set (match_operand:QI 0 "general_operand" "=d")
  5130.     (gt:QI (cc0) (const_int 0)))]
  5131.   ""
  5132.   "*
  5133.   cc_status = cc_prev_status;
  5134.   OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", 0);
  5135. ")
  5136.  
  5137. (define_insn "sgtu"
  5138.   [(set (match_operand:QI 0 "general_operand" "=d")
  5139.     (gtu:QI (cc0) (const_int 0)))]
  5140.   ""
  5141.   "* cc_status = cc_prev_status;
  5142.      return \"shi %0\"; ")
  5143.  
  5144. (define_insn "slt"
  5145.   [(set (match_operand:QI 0 "general_operand" "=d")
  5146.     (lt:QI (cc0) (const_int 0)))]
  5147.   ""
  5148.   "* cc_status = cc_prev_status;
  5149.      OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
  5150.  
  5151. (define_insn "sltu"
  5152.   [(set (match_operand:QI 0 "general_operand" "=d")
  5153.     (ltu:QI (cc0) (const_int 0)))]
  5154.   ""
  5155.   "* cc_status = cc_prev_status;
  5156.      return \"scs %0\"; ")
  5157.  
  5158. (define_insn "sge"
  5159.   [(set (match_operand:QI 0 "general_operand" "=d")
  5160.     (ge:QI (cc0) (const_int 0)))]
  5161.   ""
  5162.   "* cc_status = cc_prev_status;
  5163.      OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
  5164.  
  5165. (define_insn "sgeu"
  5166.   [(set (match_operand:QI 0 "general_operand" "=d")
  5167.     (geu:QI (cc0) (const_int 0)))]
  5168.   ""
  5169.   "* cc_status = cc_prev_status;
  5170.      return \"scc %0\"; ")
  5171.  
  5172. (define_insn "sle"
  5173.   [(set (match_operand:QI 0 "general_operand" "=d")
  5174.     (le:QI (cc0) (const_int 0)))]
  5175.   ""
  5176.   "*
  5177.   cc_status = cc_prev_status;
  5178.   OUTPUT_JUMP (\"sle %0\", \"fsle %0\", 0);
  5179. ")
  5180.  
  5181. (define_insn "sleu"
  5182.   [(set (match_operand:QI 0 "general_operand" "=d")
  5183.     (leu:QI (cc0) (const_int 0)))]
  5184.   ""
  5185.   "* cc_status = cc_prev_status;
  5186.      return \"sls %0\"; ")
  5187.  
  5188. ;; Basic conditional jump instructions.
  5189.  
  5190. (define_insn "beq0_di"
  5191.   [(set (pc)
  5192.     (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
  5193.             (const_int 0))
  5194.         (label_ref (match_operand 1 "" ","))
  5195.         (pc)))
  5196.    (clobber (match_scratch:SI 2 "=d,d"))]
  5197.   ""
  5198.   "*
  5199. {
  5200.   if (which_alternative == 1)
  5201. #ifdef MOTOROLA
  5202.     return \"move%.l %0,%2\;or%.l %0,%2\;jbeq %l1\";
  5203. #else
  5204.     return \"move%.l %0,%2\;or%.l %0,%2\;jeq %l1\";
  5205. #endif
  5206.   if (GET_CODE (operands[0]) == REG)
  5207.     operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  5208.   else
  5209.     operands[3] = adj_offsettable_operand (operands[0], 4);
  5210.   if (! ADDRESS_REG_P (operands[0]))
  5211. #ifdef MOTOROLA
  5212.     return \"move%.l %0,%2\;or%.l %3,%2\;jbeq %l1\";
  5213. #else
  5214.     return \"move%.l %0,%2\;or%.l %3,%2\;jeq %l1\";
  5215. #endif
  5216.   operands[4] = gen_label_rtx();
  5217. #ifdef MOTOROLA
  5218.   output_asm_insn (\"tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1\", operands);
  5219. #else
  5220.   output_asm_insn (\"tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1\", operands);
  5221. #endif
  5222.   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
  5223.                 CODE_LABEL_NUMBER (operands[4]));
  5224.   return \"\";
  5225. } ")
  5226.  
  5227. (define_insn "bne0_di"
  5228.   [(set (pc)
  5229.     (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
  5230.             (const_int 0))
  5231.         (label_ref (match_operand 1 "" ","))
  5232.         (pc)))
  5233.    (clobber (match_scratch:SI 2 "=d,"))]
  5234.   ""
  5235.   "*
  5236. {
  5237.   if (GET_CODE (operands[0]) == REG)
  5238.     operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  5239.   else
  5240.     operands[3] = adj_offsettable_operand (operands[0], 4);
  5241.   if (ADDRESS_REG_P (operands[0]))
  5242. #ifdef MOTOROLA
  5243.     return \"tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1\";
  5244. #else
  5245.     return \"tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1\";
  5246. #endif
  5247.   else
  5248. #ifdef MOTOROLA
  5249.     return \"move%.l %0,%2\;or%.l %3,%2\;jbne %l1\";
  5250. #else
  5251.     return \"move%.l %0,%2\;or%.l %3,%2\;jne %l1\";
  5252. #endif
  5253. } ")
  5254.  
  5255. (define_insn "bge0_di"
  5256.   [(set (pc)
  5257.     (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
  5258.             (const_int 0))
  5259.         (label_ref (match_operand 1 "" ""))
  5260.         (pc)))]
  5261.   ""
  5262.   "*
  5263. {
  5264. #ifdef MOTOROLA
  5265.   return \"tst%.l %0\;jbge %l1\";
  5266. #else
  5267.   return \"tst%.l %0\;jge %l1\";
  5268. #endif
  5269. } ")
  5270.  
  5271. (define_insn "blt0_di"
  5272.   [(set (pc)
  5273.     (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
  5274.             (const_int 0))
  5275.         (label_ref (match_operand 1 "" ""))
  5276.         (pc)))]
  5277.   ""
  5278.   "*
  5279. {
  5280. #ifdef MOTOROLA
  5281.   return \"tst%.l %0\;jbmi %l1\";
  5282. #else
  5283.   return \"tst%.l %0\;jmi %l1\";
  5284. #endif
  5285. } ")
  5286.  
  5287. (define_insn "beq"
  5288.   [(set (pc)
  5289.     (if_then_else (eq (cc0)
  5290.               (const_int 0))
  5291.               (label_ref (match_operand 0 "" ""))
  5292.               (pc)))]
  5293.   ""
  5294.   "*
  5295. {
  5296. #ifdef MOTOROLA
  5297.   OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
  5298. #else
  5299.   OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
  5300. #endif
  5301. }")
  5302.  
  5303. (define_insn "bne"
  5304.   [(set (pc)
  5305.     (if_then_else (ne (cc0)
  5306.               (const_int 0))
  5307.               (label_ref (match_operand 0 "" ""))
  5308.               (pc)))]
  5309.   ""
  5310.   "*
  5311. {
  5312. #ifdef MOTOROLA
  5313.   OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
  5314. #else
  5315.   OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
  5316. #endif
  5317. }")
  5318.  
  5319. (define_insn "bgt"
  5320.   [(set (pc)
  5321.     (if_then_else (gt (cc0)
  5322.               (const_int 0))
  5323.               (label_ref (match_operand 0 "" ""))
  5324.               (pc)))]
  5325.   ""
  5326.   "*
  5327. #ifdef MOTOROLA
  5328.   OUTPUT_JUMP (\"jbgt %l0\", \"fbgt %l0\", 0);
  5329. #else
  5330.   OUTPUT_JUMP (\"jgt %l0\", \"fjgt %l0\", 0);
  5331. #endif
  5332. ")
  5333.  
  5334. (define_insn "bgtu"
  5335.   [(set (pc)
  5336.     (if_then_else (gtu (cc0)
  5337.                (const_int 0))
  5338.               (label_ref (match_operand 0 "" ""))
  5339.               (pc)))]
  5340.   ""
  5341.   "*
  5342. #ifdef MOTOROLA
  5343.   return \"jbhi %l0\";
  5344. #else
  5345.   return \"jhi %l0\";
  5346. #endif
  5347. ")
  5348.  
  5349. (define_insn "blt"
  5350.   [(set (pc)
  5351.     (if_then_else (lt (cc0)
  5352.               (const_int 0))
  5353.               (label_ref (match_operand 0 "" ""))
  5354.               (pc)))]
  5355.   ""
  5356.   "*
  5357. #ifdef MOTOROLA
  5358.   OUTPUT_JUMP (\"jblt %l0\", \"fblt %l0\", \"jbmi %l0\");
  5359. #else
  5360.   OUTPUT_JUMP (\"jlt %l0\", \"fjlt %l0\", \"jmi %l0\");
  5361. #endif
  5362. ")
  5363.  
  5364. (define_insn "bltu"
  5365.   [(set (pc)
  5366.     (if_then_else (ltu (cc0)
  5367.                (const_int 0))
  5368.               (label_ref (match_operand 0 "" ""))
  5369.               (pc)))]
  5370.   ""
  5371.   "*
  5372. #ifdef MOTOROLA
  5373.   return \"jbcs %l0\";
  5374. #else
  5375.   return \"jcs %l0\";
  5376. #endif
  5377. ")
  5378.  
  5379. (define_insn "bge"
  5380.   [(set (pc)
  5381.     (if_then_else (ge (cc0)
  5382.               (const_int 0))
  5383.               (label_ref (match_operand 0 "" ""))
  5384.               (pc)))]
  5385.   ""
  5386.   "*
  5387. #ifdef MOTOROLA
  5388.   OUTPUT_JUMP (\"jbge %l0\", \"fbge %l0\", \"jbpl %l0\");
  5389. #else
  5390.   OUTPUT_JUMP (\"jge %l0\", \"fjge %l0\", \"jpl %l0\");
  5391. #endif
  5392. ")
  5393.  
  5394. (define_insn "bgeu"
  5395.   [(set (pc)
  5396.     (if_then_else (geu (cc0)
  5397.                (const_int 0))
  5398.               (label_ref (match_operand 0 "" ""))
  5399.               (pc)))]
  5400.   ""
  5401.   "*
  5402. #ifdef MOTOROLA
  5403.   return \"jbcc %l0\";
  5404. #else
  5405.   return \"jcc %l0\";
  5406. #endif
  5407. ")
  5408.  
  5409. (define_insn "ble"
  5410.   [(set (pc)
  5411.     (if_then_else (le (cc0)
  5412.               (const_int 0))
  5413.               (label_ref (match_operand 0 "" ""))
  5414.               (pc)))]
  5415.   ""
  5416.   "*
  5417. #ifdef MOTOROLA
  5418.   OUTPUT_JUMP (\"jble %l0\", \"fble %l0\", 0);
  5419. #else
  5420.   OUTPUT_JUMP (\"jle %l0\", \"fjle %l0\", 0);
  5421. #endif
  5422. ")
  5423.  
  5424. (define_insn "bleu"
  5425.   [(set (pc)
  5426.     (if_then_else (leu (cc0)
  5427.                (const_int 0))
  5428.               (label_ref (match_operand 0 "" ""))
  5429.               (pc)))]
  5430.   ""
  5431.   "*
  5432. #ifdef MOTOROLA
  5433.   return \"jbls %l0\";
  5434. #else
  5435.   return \"jls %l0\";
  5436. #endif
  5437. ")
  5438.  
  5439. ;; Negated conditional jump instructions.
  5440.  
  5441. (define_insn ""
  5442.   [(set (pc)
  5443.     (if_then_else (eq (cc0)
  5444.               (const_int 0))
  5445.               (pc)
  5446.               (label_ref (match_operand 0 "" ""))))]
  5447.   ""
  5448.   "*
  5449. {
  5450. #ifdef MOTOROLA
  5451.   OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
  5452. #else
  5453.   OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
  5454. #endif
  5455. }")
  5456.  
  5457. (define_insn ""
  5458.   [(set (pc)
  5459.     (if_then_else (ne (cc0)
  5460.               (const_int 0))
  5461.               (pc)
  5462.               (label_ref (match_operand 0 "" ""))))]
  5463.   ""
  5464.   "*
  5465. {
  5466. #ifdef MOTOROLA
  5467.   OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
  5468. #else
  5469.   OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
  5470. #endif
  5471. }")
  5472.  
  5473. (define_insn ""
  5474.   [(set (pc)
  5475.     (if_then_else (gt (cc0)
  5476.               (const_int 0))
  5477.               (pc)
  5478.               (label_ref (match_operand 0 "" ""))))]
  5479.   ""
  5480.   "*
  5481. #ifdef MOTOROLA
  5482.   OUTPUT_JUMP (\"jble %l0\", \"fbngt %l0\", 0);
  5483. #else
  5484.   OUTPUT_JUMP (\"jle %l0\", \"fjngt %l0\", 0);
  5485. #endif
  5486. ")
  5487.  
  5488. (define_insn ""
  5489.   [(set (pc)
  5490.     (if_then_else (gtu (cc0)
  5491.                (const_int 0))
  5492.               (pc)
  5493.               (label_ref (match_operand 0 "" ""))))]
  5494.   ""
  5495.   "*
  5496. #ifdef MOTOROLA
  5497.   return \"jbls %l0\";
  5498. #else
  5499.   return \"jls %l0\";
  5500. #endif
  5501. ")
  5502.  
  5503. (define_insn ""
  5504.   [(set (pc)
  5505.     (if_then_else (lt (cc0)
  5506.               (const_int 0))
  5507.               (pc)
  5508.               (label_ref (match_operand 0 "" ""))))]
  5509.   ""
  5510.   "*
  5511. #ifdef MOTOROLA
  5512.   OUTPUT_JUMP (\"jbge %l0\", \"fbnlt %l0\", \"jbpl %l0\");
  5513. #else
  5514.   OUTPUT_JUMP (\"jge %l0\", \"fjnlt %l0\", \"jpl %l0\");
  5515. #endif
  5516. ")
  5517.  
  5518. (define_insn ""
  5519.   [(set (pc)
  5520.     (if_then_else (ltu (cc0)
  5521.                (const_int 0))
  5522.               (pc)
  5523.               (label_ref (match_operand 0 "" ""))))]
  5524.   ""
  5525.   "*
  5526. #ifdef MOTOROLA
  5527.   return \"jbcc %l0\";
  5528. #else
  5529.   return \"jcc %l0\";
  5530. #endif
  5531. ")
  5532.  
  5533. (define_insn ""
  5534.   [(set (pc)
  5535.     (if_then_else (ge (cc0)
  5536.               (const_int 0))
  5537.               (pc)
  5538.               (label_ref (match_operand 0 "" ""))))]
  5539.   ""
  5540.   "*
  5541. #ifdef MOTOROLA
  5542.   OUTPUT_JUMP (\"jblt %l0\", \"fbnge %l0\", \"jbmi %l0\");
  5543. #else
  5544.   OUTPUT_JUMP (\"jlt %l0\", \"fjnge %l0\", \"jmi %l0\");
  5545. #endif
  5546. ")
  5547.  
  5548. (define_insn ""
  5549.   [(set (pc)
  5550.     (if_then_else (geu (cc0)
  5551.                (const_int 0))
  5552.               (pc)
  5553.               (label_ref (match_operand 0 "" ""))))]
  5554.   ""
  5555.   "*
  5556. #ifdef MOTOROLA
  5557.   return \"jbcs %l0\";
  5558. #else
  5559.   return \"jcs %l0\";
  5560. #endif
  5561. ")
  5562.  
  5563. (define_insn ""
  5564.   [(set (pc)
  5565.     (if_then_else (le (cc0)
  5566.               (const_int 0))
  5567.               (pc)
  5568.               (label_ref (match_operand 0 "" ""))))]
  5569.   ""
  5570.   "*
  5571. #ifdef MOTOROLA
  5572.   OUTPUT_JUMP (\"jbgt %l0\", \"fbnle %l0\", 0);
  5573. #else
  5574.   OUTPUT_JUMP (\"jgt %l0\", \"fjnle %l0\", 0);
  5575. #endif
  5576. ")
  5577.  
  5578. (define_insn ""
  5579.   [(set (pc)
  5580.     (if_then_else (leu (cc0)
  5581.                (const_int 0))
  5582.               (pc)
  5583.               (label_ref (match_operand 0 "" ""))))]
  5584.   ""
  5585.   "*
  5586. #ifdef MOTOROLA
  5587.   return \"jbhi %l0\";
  5588. #else
  5589.   return \"jhi %l0\";
  5590. #endif
  5591. ")
  5592.  
  5593. ;; Unconditional and other jump instructions
  5594. (define_insn "jump"
  5595.   [(set (pc)
  5596.     (label_ref (match_operand 0 "" "")))]
  5597.   ""
  5598.   "*
  5599. #ifdef MOTOROLA
  5600.   return \"jbra %l0\";
  5601. #else
  5602.   return \"jra %l0\";
  5603. #endif
  5604. ")
  5605.  
  5606. ;; We support two different ways of handling dispatch tables.
  5607. ;; The NeXT uses absolute tables, and other machines use relative.
  5608. ;; This define_expand can generate either kind.
  5609. (define_expand "tablejump"
  5610.   [(parallel [(set (pc) (match_operand 0 "" ""))
  5611.           (use (label_ref (match_operand 1 "" "")))])]
  5612.   ""
  5613.   "
  5614. {
  5615. #ifdef CASE_VECTOR_PC_RELATIVE
  5616.     operands[0] = gen_rtx (PLUS, SImode, pc_rtx,
  5617.                gen_rtx (SIGN_EXTEND, SImode, operands[0]));
  5618. #endif
  5619. }")
  5620.  
  5621. ;; Jump to variable address from dispatch table of absolute addresses.
  5622. (define_insn ""
  5623.   [(set (pc) (match_operand:SI 0 "register_operand" "a"))
  5624.    (use (label_ref (match_operand 1 "" "")))]
  5625.   ""
  5626.   "*
  5627. #ifdef MOTOROLA
  5628.   return \"jmp (%0)\";
  5629. #else
  5630.   return \"jmp %0@\";
  5631. #endif
  5632. ")
  5633.  
  5634. ;; Jump to variable address from dispatch table of relative addresses.
  5635. (define_insn ""
  5636.   [(set (pc)
  5637.     (plus:SI (pc)
  5638.          (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
  5639.    (use (label_ref (match_operand 1 "" "")))]
  5640.   ""
  5641.   "*
  5642. #ifdef ASM_RETURN_CASE_JUMP
  5643.  ASM_RETURN_CASE_JUMP;
  5644. #else
  5645. #ifdef SGS
  5646. #ifdef ASM_OUTPUT_CASE_LABEL
  5647.   return \"jmp 6(%%pc,%0.w)\";
  5648. #else
  5649. #ifdef CRDS
  5650.   return \"jmp 2(pc,%0.w)\";
  5651. #else
  5652.   return \"jmp 2(%%pc,%0.w)\";
  5653. #endif  /* end !CRDS */
  5654. #endif
  5655. #else /* not SGS */
  5656. #ifdef MOTOROLA
  5657.   return \"jmp (2,pc,%0.w)\";
  5658. #else
  5659.   return \"jmp pc@(2,%0:w)\";
  5660. #endif
  5661. #endif
  5662. #endif
  5663. ")
  5664.  
  5665. ;; Decrement-and-branch insns.
  5666. (define_insn ""
  5667.   [(set (pc)
  5668.     (if_then_else
  5669.      (ne (match_operand:HI 0 "general_operand" "+g")
  5670.          (const_int 0))
  5671.      (label_ref (match_operand 1 "" ""))
  5672.      (pc)))
  5673.    (set (match_dup 0)
  5674.     (plus:HI (match_dup 0)
  5675.          (const_int -1)))]
  5676.   ""
  5677.   "*
  5678. {
  5679.   CC_STATUS_INIT;
  5680.   if (DATA_REG_P (operands[0]))
  5681.     return \"dbra %0,%l1\";
  5682.   if (GET_CODE (operands[0]) == MEM)
  5683.     {
  5684. #ifdef MOTOROLA
  5685. #ifdef NO_ADDSUB_Q
  5686.       return \"sub%.w %#1,%0\;jbcc %l1\";
  5687. #else
  5688.       return \"subq%.w %#1,%0\;jbcc %l1\";
  5689. #endif
  5690. #else /* not MOTOROLA */
  5691.       return \"subqw %#1,%0\;jcc %l1\";
  5692. #endif
  5693.     }
  5694. #ifdef MOTOROLA
  5695. #ifdef SGS_CMP_ORDER
  5696. #ifdef NO_ADDSUB_Q
  5697.   return \"sub%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
  5698. #else
  5699.   return \"subq%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
  5700. #endif
  5701. #else /* not SGS_CMP_ORDER */
  5702.   return \"subq%.w %#1,%0\;cmp%.w %#-1,%0\;jbne %l1\";
  5703. #endif
  5704. #else /* not MOTOROLA */
  5705.   return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
  5706. #endif
  5707. }")
  5708.  
  5709. (define_insn ""
  5710.   [(set (pc)
  5711.     (if_then_else
  5712.      (ne (match_operand:SI 0 "general_operand" "+g")
  5713.          (const_int 0))
  5714.      (label_ref (match_operand 1 "" ""))
  5715.      (pc)))
  5716.    (set (match_dup 0)
  5717.     (plus:SI (match_dup 0)
  5718.          (const_int -1)))]
  5719.   ""
  5720.   "*
  5721. {
  5722.   CC_STATUS_INIT;
  5723. #ifdef MOTOROLA
  5724. #ifdef NO_ADDSUB_Q
  5725.   if (DATA_REG_P (operands[0]))
  5726.     return \"dbra %0,%l1\;clr%.w %0\;sub%.l %#1,%0\;jbcc %l1\";
  5727.   if (GET_CODE (operands[0]) == MEM)
  5728.     return \"sub%.l %#1,%0\;jbcc %l1\";
  5729. #else
  5730.   if (DATA_REG_P (operands[0]))
  5731.     return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
  5732.   if (GET_CODE (operands[0]) == MEM)
  5733.     return \"subq%.l %#1,%0\;jbcc %l1\";
  5734. #endif /* NO_ADDSUB_Q */
  5735. #ifdef SGS_CMP_ORDER
  5736. #ifdef NO_ADDSUB_Q
  5737.   return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  5738. #else
  5739.   return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  5740. #endif
  5741. #else /* not SGS_CMP_ORDER */
  5742.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
  5743. #endif /* not SGS_CMP_ORDER */
  5744. #else /* not MOTOROLA */
  5745.   if (DATA_REG_P (operands[0]))
  5746.     return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
  5747.   if (GET_CODE (operands[0]) == MEM)
  5748.     return \"subql %#1,%0\;jcc %l1\";
  5749.   return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
  5750. #endif /* not MOTOROLA */
  5751. }")
  5752.  
  5753. ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
  5754.  
  5755. (define_insn ""
  5756.   [(set (pc)
  5757.     (if_then_else
  5758.       (ge (plus:HI (match_operand:HI 0 "general_operand" "+d*am")
  5759.                (const_int -1))
  5760.           (const_int 0))
  5761.       (label_ref (match_operand 1 "" ""))
  5762.       (pc)))
  5763.    (set (match_dup 0)
  5764.     (plus:HI (match_dup 0)
  5765.          (const_int -1)))]
  5766.   "find_reg_note (insn, REG_NONNEG, 0)"
  5767.   "*
  5768. {
  5769.   CC_STATUS_INIT;
  5770. #ifdef MOTOROLA
  5771. #ifdef NO_ADDSUB_Q
  5772.   if (DATA_REG_P (operands[0]))
  5773.     return \"dbra %0,%l1\";
  5774.   if (GET_CODE (operands[0]) == MEM)
  5775.     return \"sub%.w %#1,%0\;jbcc %l1\";
  5776. #else
  5777.   if (DATA_REG_P (operands[0]))
  5778.     return \"dbra %0,%l1\";
  5779.   if (GET_CODE (operands[0]) == MEM)
  5780.     return \"subq%.w %#1,%0\;jbcc %l1\";
  5781. #endif
  5782. #ifdef SGS_CMP_ORDER
  5783. #ifdef NO_ADDSUB_Q
  5784.   return \"sub.w %#1,%0\;cmp.w %0,%#-1\;jbne %l1\";
  5785. #else
  5786.   return \"subq.w %#1,%0\;cmp.w %0,%#-1\;jbne %l1\";
  5787. #endif
  5788. #else /* not SGS_CMP_ORDER */
  5789.   return \"subq.w %#1,%0\;cmp.w %#-1,%0\;jbne %l1\";
  5790. #endif /* not SGS_CMP_ORDER */
  5791. #else /* not MOTOROLA */
  5792.   if (DATA_REG_P (operands[0]))
  5793.     return \"dbra %0,%l1\";
  5794.   if (GET_CODE (operands[0]) == MEM)
  5795.     return \"subqw %#1,%0\;jcc %l1\";
  5796.   return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
  5797. #endif /* not MOTOROLA */
  5798. }")
  5799.  
  5800. (define_insn "decrement_and_branch_until_zero"
  5801.   [(set (pc)
  5802.     (if_then_else
  5803.       (ge (plus:SI (match_operand:SI 0 "general_operand" "+d*am")
  5804.                (const_int -1))
  5805.           (const_int 0))
  5806.       (label_ref (match_operand 1 "" ""))
  5807.       (pc)))
  5808.    (set (match_dup 0)
  5809.     (plus:SI (match_dup 0)
  5810.          (const_int -1)))]
  5811.   "find_reg_note (insn, REG_NONNEG, 0)"
  5812.   "*
  5813. {
  5814.   CC_STATUS_INIT;
  5815. #ifdef MOTOROLA
  5816. #ifdef NO_ADDSUB_Q
  5817.   if (DATA_REG_P (operands[0]))
  5818.     return \"dbra %0,%l1\;clr%.w %0\;sub%.l %#1,%0\;jbcc %l1\";
  5819.   if (GET_CODE (operands[0]) == MEM)
  5820.     return \"sub%.l %#1,%0\;jbcc %l1\";
  5821. #else
  5822.   if (DATA_REG_P (operands[0]))
  5823.     return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
  5824.   if (GET_CODE (operands[0]) == MEM)
  5825.     return \"subq%.l %#1,%0\;jbcc %l1\";
  5826. #endif
  5827. #ifdef SGS_CMP_ORDER
  5828. #ifdef NO_ADDSUB_Q
  5829.   return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  5830. #else
  5831.   return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  5832. #endif
  5833. #else /* not SGS_CMP_ORDER */
  5834.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
  5835. #endif /* not SGS_CMP_ORDER */
  5836. #else /* not MOTOROLA */
  5837.   if (DATA_REG_P (operands[0]))
  5838.     return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
  5839.   if (GET_CODE (operands[0]) == MEM)
  5840.     return \"subql %#1,%0\;jcc %l1\";
  5841.   return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
  5842. #endif /* not MOTOROLA */
  5843. }")
  5844.  
  5845.  
  5846. ;; PIC calls are handled by loading the address of the function into a 
  5847. ;; register (via movsi), then emitting a register indirect call using
  5848. ;; the "jsr" function call syntax.
  5849. ;;
  5850. ;; It is important to note that the "jsr" syntax is always used for 
  5851. ;; PIC calls, even on machines in which GCC normally uses the "jbsr"
  5852. ;; syntax for non-PIC calls.  This keeps at least 1 assembler (Sun)
  5853. ;; from emitting incorrect code for a PIC call.
  5854. ;;
  5855. ;; We have different patterns for PIC calls and non-PIC calls.  The
  5856. ;; different patterns are only used to choose the right syntax
  5857. ;; ("jsr" vs "jbsr").
  5858. ;;
  5859. ;; On svr4 m68k, PIC stuff is done differently. To be able to support
  5860. ;; dynamic linker LAZY BINDING, all the procedure calls need to go 
  5861. ;; through the PLT (Procedure Linkage Table) section in PIC mode. The 
  5862. ;; svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it 
  5863. ;; will create the correct relocation entry (R_68K_PLT32) for `FUNC', 
  5864. ;; that tells the linker editor to create an entry for `FUNC' in PLT
  5865. ;; section at link time. However, all global objects reference are still
  5866. ;; done by using `OBJ@GOT'. So, the goal here is to output the function 
  5867. ;; call operand as `FUNC@PLTPC', but output object operand as `OBJ@GOT'. 
  5868. ;; We need to have a way to differentiate these two different operands.
  5869. ;;
  5870. ;; The strategy I use here is to use SYMBOL_REF_FLAG to differentiate 
  5871. ;; these two different operands. The macro LEGITIMATE_PIC_OPERAND_P needs
  5872. ;; to be changed to recognize function calls symbol_ref operand as a valid 
  5873. ;; PIC operand (by checking whether SYMBOL_REF_FLAG is set). This will 
  5874. ;; avoid the compiler to load this symbol_ref operand into a register. 
  5875. ;; Remember, the operand "foo@PLTPC" cannot be called via jsr directly 
  5876. ;; since the value is a PC relative offset, not a real address.
  5877. ;;
  5878. ;; All global objects are treated in the similar way as in SUN3. The only 
  5879. ;; difference is: on m68k svr4, the reference of such global object needs 
  5880. ;; to end with a suffix "@GOT" so the assembler and linker know to create
  5881. ;; an entry for it in GOT (Global Offset Table) section. This is done in 
  5882. ;; m68k.c.
  5883.  
  5884. ;; Call subroutine with no return value.
  5885. (define_expand "call"
  5886.   [(call (match_operand:QI 0 "memory_operand" "")
  5887.      (match_operand:SI 1 "general_operand" ""))]
  5888.   ;; Operand 1 not really used on the m68000.
  5889.  
  5890.   ""
  5891.   "
  5892. {
  5893.   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  5894. #ifdef MOTOROLA
  5895.     SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1;
  5896. #else
  5897.     operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  5898.                force_reg (Pmode, XEXP (operands[0], 0)));
  5899. #endif
  5900. }")
  5901.  
  5902. ;; This is a normal call sequence.
  5903. (define_insn ""
  5904.   [(call (match_operand:QI 0 "memory_operand" "o")
  5905.      (match_operand:SI 1 "general_operand" "g"))]
  5906.   ;; Operand 1 not really used on the m68000.
  5907.  
  5908.   "(! flag_pic || flag_pic >= 3)"
  5909.   "*
  5910. #ifdef MOTOROLA
  5911. #ifdef MOTOROLA_BSR
  5912.   if (GET_CODE (operands[0]) == MEM 
  5913.       && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  5914.     return \"bsr %0\";
  5915. #endif
  5916.   return \"jsr %0\";
  5917. #else
  5918.   return \"jbsr %0\";
  5919. #endif
  5920. ")
  5921.  
  5922. ;; This is a PIC call sequence.
  5923. (define_insn ""
  5924.   [(call (match_operand:QI 0 "memory_operand" "o")
  5925.      (match_operand:SI 1 "general_operand" "g"))]
  5926.   ;; Operand 1 not really used on the m68000.
  5927.  
  5928.   "(flag_pic && flag_pic < 3)"
  5929.   "*
  5930. #ifdef MOTOROLA
  5931.   if (GET_CODE (operands[0]) == MEM 
  5932.       && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  5933. #ifdef HPUX_ASM
  5934.     return \"bsr.l %0\";
  5935. #else
  5936.     return \"bsr %0@PLTPC\";
  5937. #endif
  5938. #endif
  5939.   return \"jsr %0\";
  5940. ")
  5941.  
  5942. ;; Call subroutine, returning value in operand 0
  5943. ;; (which must be a hard register).
  5944. ;; See comments before "call" regarding PIC calls.
  5945. (define_expand "call_value"
  5946.   [(set (match_operand 0 "" "")
  5947.     (call (match_operand:QI 1 "memory_operand" "")
  5948.      (match_operand:SI 2 "general_operand" "")))]
  5949.   ;; Operand 2 not really used on the m68000.
  5950.   ""
  5951.   "
  5952. {
  5953.   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  5954. #ifdef MOTOROLA
  5955.     SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1;
  5956. #else
  5957.     operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  5958.                force_reg (Pmode, XEXP (operands[1], 0)));
  5959. #endif
  5960. }")
  5961.  
  5962. ;; This is a normal call_value
  5963. (define_insn ""
  5964.   [(set (match_operand 0 "" "=rf")
  5965.     (call (match_operand:QI 1 "memory_operand" "o")
  5966.           (match_operand:SI 2 "general_operand" "g")))]
  5967.   ;; Operand 2 not really used on the m68000.
  5968.   "(! flag_pic || flag_pic >= 3)"
  5969.   "*
  5970. #ifdef MOTOROLA
  5971. #ifdef MOTOROLA_BSR
  5972.   if (GET_CODE (operands[1]) == MEM 
  5973.       && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  5974.     return \"bsr %1\";
  5975. #endif
  5976.   return \"jsr %1\";
  5977. #else
  5978.   return \"jbsr %1\";
  5979. #endif
  5980. ")
  5981.  
  5982. ;; This is a PIC call_value
  5983. (define_insn ""
  5984.   [(set (match_operand 0 "" "=rf")
  5985.     (call (match_operand:QI 1 "memory_operand" "o")
  5986.           (match_operand:SI 2 "general_operand" "g")))]
  5987.   ;; Operand 2 not really used on the m68000.
  5988.   "(flag_pic && flag_pic < 3)"
  5989.   "*
  5990. #ifdef MOTOROLA
  5991.   if (GET_CODE (operands[1]) == MEM 
  5992.       && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  5993. #ifdef HPUX_ASM
  5994.     return \"bsr.l %1\";
  5995. #else
  5996.     return \"bsr %1@PLTPC\";
  5997. #endif
  5998. #endif
  5999.   return \"jsr %1\";
  6000. ")
  6001.  
  6002. ;; Call subroutine returning any type.
  6003.  
  6004. (define_expand "untyped_call"
  6005.   [(parallel [(call (match_operand 0 "" "")
  6006.             (const_int 0))
  6007.           (match_operand 1 "" "")
  6008.           (match_operand 2 "" "")])]
  6009.   "NEEDS_UNTYPED_CALL"
  6010.   "
  6011. {
  6012.   int i;
  6013.  
  6014.   emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
  6015.  
  6016.   for (i = 0; i < XVECLEN (operands[2], 0); i++)
  6017.     {
  6018.       rtx set = XVECEXP (operands[2], 0, i);
  6019.       emit_move_insn (SET_DEST (set), SET_SRC (set));
  6020.     }
  6021.  
  6022.   /* The optimizer does not know that the call sets the function value
  6023.      registers we stored in the result block.  We avoid problems by
  6024.      claiming that all hard registers are used and clobbered at this
  6025.      point.  */
  6026.   emit_insn (gen_blockage ());
  6027.  
  6028.   DONE;
  6029. }")
  6030.  
  6031. ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
  6032. ;; all of memory.  This blocks insns from being moved across this point.
  6033.  
  6034. (define_insn "blockage"
  6035.   [(unspec_volatile [(const_int 0)] 0)]
  6036.   ""
  6037.   "")
  6038.  
  6039. (define_insn "nop"
  6040.   [(const_int 0)]
  6041.   ""
  6042.   "nop")
  6043.  
  6044. (define_insn "probe"
  6045.  [(reg:SI 15)]
  6046.  "NEED_PROBE"
  6047.  "*
  6048. {
  6049.   operands[0] = gen_rtx (PLUS, SImode, stack_pointer_rtx,
  6050.              gen_rtx (CONST_INT, VOIDmode, NEED_PROBE));
  6051.   return \"tstl %a0\";
  6052. }")
  6053.  
  6054. ;; Used for frameless functions which save no regs and allocate no locals.
  6055. (define_insn "return"
  6056.   [(return)]
  6057.   "USE_RETURN_INSN"
  6058.   "*
  6059. {
  6060.   if (current_function_pops_args == 0)
  6061.     return \"rts\";
  6062.   operands[0] = gen_rtx (CONST_INT, VOIDmode, current_function_pops_args);
  6063.   return \"rtd %0\";
  6064. }")
  6065.  
  6066. (define_insn "indirect_jump"
  6067.   [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
  6068.   ""
  6069.   "jmp %a0")
  6070.  
  6071. ;; This should not be used unless the add/sub insns can't be.
  6072.  
  6073. (define_insn ""
  6074.   [(set (match_operand:SI 0 "general_operand" "=a")
  6075.     (match_operand:QI 1 "address_operand" "p"))]
  6076.   ""
  6077.   "*
  6078. {
  6079. #ifndef SGS_NO_LI
  6080.   /* Recognize an insn that refers to a table of offsets.  Such an insn will
  6081.      need to refer to a label on the insn.  So output one.  Use the
  6082.      label-number of the table of offsets to generate this label.  This code,
  6083.      and similar code above, assumes that there will be at most one reference
  6084.      to each table.  */
  6085.   if (GET_CODE (operands[1]) == PLUS
  6086.       && GET_CODE (XEXP (operands[1], 1)) == LABEL_REF
  6087.       && GET_CODE (XEXP (operands[1], 0)) != PLUS)
  6088.     {
  6089.       rtx labelref = XEXP (operands[1], 1);
  6090. #if defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES)
  6091. #ifdef SGS
  6092.       asm_fprintf (asm_out_file, \"\\tset %LLI%d,.+2\\n\",
  6093.            CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  6094. #else /* not SGS */
  6095.       asm_fprintf (asm_out_file, \"\\t.set %LLI%d,.+2\\n\",
  6096.                CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  6097. #endif /* not SGS */
  6098. #else /* SGS_SWITCH_TABLES or not MOTOROLA */
  6099.       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
  6100.                  CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  6101. #ifdef SGS_SWITCH_TABLES
  6102.       /* Set flag saying we need to define the symbol
  6103.      LD%n (with value L%n-LI%n) at the end of the switch table.  */
  6104.       switch_table_difference_label_flag = 1;
  6105. #endif /* SGS_SWITCH_TABLES */
  6106. #endif /* SGS_SWITCH_TABLES or not MOTOROLA */
  6107.     }
  6108. #endif /* SGS_NO_LI */
  6109.  
  6110.   return \"lea %a1,%0\";
  6111. }")
  6112.  
  6113. ;; This is the first machine-dependent peephole optimization.
  6114. ;; It is useful when a floating value is returned from a function call
  6115. ;; and then is moved into an FP register.
  6116. ;; But it is mainly intended to test the support for these optimizations.
  6117.  
  6118. (define_peephole
  6119.   [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
  6120.    (set (match_operand:DF 0 "register_operand" "=f")
  6121.     (match_operand:DF 1 "register_operand" "ad"))]
  6122.   "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
  6123.   "*
  6124. {
  6125.   rtx xoperands[2];
  6126.   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  6127.   output_asm_insn (\"move%.l %1,%@\", xoperands);
  6128.   output_asm_insn (\"move%.l %1,%-\", operands);
  6129.   return \"fmove%.d %+,%0\";
  6130. }
  6131. ")
  6132.  
  6133. ;; Optimize a stack-adjust followed by a push of an argument.
  6134. ;; This is said to happen frequently with -msoft-float
  6135. ;; when there are consecutive library calls.
  6136.  
  6137. (define_peephole
  6138.   [(set (reg:SI 15) (plus:SI (reg:SI 15)
  6139.                  (match_operand:SI 0 "const_int_operand" "n")))
  6140.    (set (match_operand:SF 1 "push_operand" "=m")
  6141.     (match_operand:SF 2 "general_operand" "rmfF"))]
  6142.   "INTVAL (operands[0]) >= 4
  6143.    && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
  6144.   "*
  6145. {
  6146.   if (INTVAL (operands[0]) > 4)
  6147.     {
  6148.       rtx xoperands[2];
  6149.       xoperands[0] = stack_pointer_rtx;
  6150.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[0]) - 4);
  6151. #ifndef NO_ADDSUB_Q
  6152.       if (INTVAL (xoperands[1]) <= 8)
  6153.         output_asm_insn (\"addq%.w %1,%0\", xoperands);
  6154.       else if (INTVAL (xoperands[1]) <= 16 && TARGET_68020)
  6155.     {
  6156.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, 
  6157.                   INTVAL (xoperands[1]) - 8);
  6158.       output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
  6159.     }
  6160.       else
  6161. #endif
  6162.         if (INTVAL (xoperands[1]) <= 0x7FFF)
  6163.           output_asm_insn (\"add%.w %1,%0\", xoperands);
  6164.       else
  6165.         output_asm_insn (\"add%.l %1,%0\", xoperands);
  6166.     }
  6167.   if (FP_REG_P (operands[2]))
  6168.     return \"fmove%.s %2,%@\";
  6169.   return \"move%.l %2,%@\";
  6170. }")
  6171.  
  6172. ;; Speed up stack adjust followed by a fullword fixedpoint push.
  6173.  
  6174. (define_peephole
  6175.   [(set (reg:SI 15) (plus:SI (reg:SI 15)
  6176.                  (match_operand:SI 0 "const_int_operand" "n")))
  6177.    (set (match_operand:SI 1 "push_operand" "=m")
  6178.     (match_operand:SI 2 "general_operand" "g"))]
  6179.   "INTVAL (operands[0]) >= 4
  6180.    && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
  6181.   "*
  6182. {
  6183.   if (INTVAL (operands[0]) > 4)
  6184.     {
  6185.       rtx xoperands[2];
  6186.       xoperands[0] = stack_pointer_rtx;
  6187.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[0]) - 4);
  6188. #ifndef NO_ADDSUB_Q
  6189.       if (INTVAL (xoperands[1]) <= 8)
  6190.         output_asm_insn (\"addq%.w %1,%0\", xoperands);
  6191.       else if (INTVAL (xoperands[1]) <= 16 && TARGET_68020)
  6192.     {
  6193.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode, 
  6194.                   INTVAL (xoperands[1]) - 8);
  6195.       output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
  6196.     }
  6197.       else
  6198. #endif
  6199.         if (INTVAL (xoperands[1]) <= 0x7FFF)
  6200.           output_asm_insn (\"add%.w %1,%0\", xoperands);
  6201.       else
  6202.         output_asm_insn (\"add%.l %1,%0\", xoperands);
  6203.     }
  6204.   if (operands[2] == const0_rtx)
  6205.     return \"clr%.l %@\";
  6206.   return \"move%.l %2,%@\";
  6207. }")
  6208.  
  6209. ;; Speed up pushing a single byte but leaving four bytes of space.
  6210.  
  6211. (define_peephole
  6212.   [(set (mem:QI (pre_dec:SI (reg:SI 15)))
  6213.     (match_operand:QI 1 "general_operand" "dami"))
  6214.    (set (reg:SI 15) (minus:SI (reg:SI 15) (const_int 2)))]
  6215.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
  6216.   "*
  6217. {
  6218.   rtx xoperands[4];
  6219.  
  6220.   if (GET_CODE (operands[1]) == REG)
  6221.     return \"move%.l %1,%-\";
  6222.  
  6223.   xoperands[1] = operands[1];
  6224.   xoperands[2]
  6225.     = gen_rtx (MEM, QImode,
  6226.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx,
  6227.             gen_rtx (CONST_INT, VOIDmode, 3)));
  6228.   xoperands[3] = stack_pointer_rtx;
  6229.   output_asm_insn (\"subq%.w %#4,%3\;move%.b %1,%2\", xoperands);
  6230.   return \"\";
  6231. }")
  6232.  
  6233. (define_peephole
  6234.   [(set (match_operand:SI 0 "register_operand" "=d")
  6235.     (const_int 0))
  6236.    (set (strict_low_part (subreg:HI (match_dup 0) 0))
  6237.     (match_operand:HI 1 "general_operand" "rmn"))]
  6238.   "strict_low_part_peephole_ok (HImode, prev_nonnote_insn (insn), operands[0])"
  6239.   "*
  6240. {
  6241.   if (GET_CODE (operands[1]) == CONST_INT)
  6242.     {
  6243.       if (operands[1] == const0_rtx
  6244.       && (DATA_REG_P (operands[0])
  6245.           || GET_CODE (operands[0]) == MEM)
  6246.       /* clr insns on 68000 read before writing.
  6247.          This isn't so on the 68010, but we have no alternative for it.  */
  6248.       && (TARGET_68020
  6249.           || !(GET_CODE (operands[0]) == MEM
  6250.            && MEM_VOLATILE_P (operands[0]))))
  6251.     return \"clr%.w %0\";
  6252.     }
  6253.   return \"move%.w %1,%0\";
  6254. }")
  6255.  
  6256. ;; dbCC peepholes
  6257. ;;
  6258. ;; Turns
  6259. ;;   loop:
  6260. ;;           [ ... ]
  6261. ;;           jCC label        ; abnormal loop termination
  6262. ;;           dbra dN, loop    ; normal loop termination
  6263. ;;
  6264. ;; Into
  6265. ;;   loop:
  6266. ;;           [ ... ]
  6267. ;;           dbCC dN, loop
  6268. ;;           jCC label
  6269. ;;
  6270. ;; Which moves the jCC condition outside the inner loop for free.
  6271. ;;
  6272. (define_peephole
  6273.   [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
  6274.                              [(cc0) (const_int 0)])
  6275.                            (label_ref (match_operand 2 "" ""))
  6276.                            (pc)))
  6277.    (parallel
  6278.     [(set (pc)
  6279.       (if_then_else
  6280.         (ge (plus:HI (match_operand:HI 0 "register_operand" "+d")
  6281.                  (const_int -1))
  6282.             (const_int 0))
  6283.         (label_ref (match_operand 1 "" ""))
  6284.         (pc)))
  6285.      (set (match_dup 0)
  6286.       (plus:HI (match_dup 0)
  6287.            (const_int -1)))])]
  6288.   "DATA_REG_P (operands[0])"
  6289.   "*
  6290. {
  6291.   CC_STATUS_INIT;
  6292.   output_dbcc_and_branch (operands);
  6293.   return \"\";
  6294. }")
  6295.  
  6296. (define_peephole
  6297.   [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
  6298.                              [(cc0) (const_int 0)])
  6299.                            (label_ref (match_operand 2 "" ""))
  6300.                            (pc)))
  6301.    (parallel
  6302.     [(set (pc)
  6303.       (if_then_else
  6304.         (ge (plus:SI (match_operand:SI 0 "register_operand" "+d")
  6305.                  (const_int -1))
  6306.             (const_int 0))
  6307.         (label_ref (match_operand 1 "" ""))
  6308.         (pc)))
  6309.      (set (match_dup 0)
  6310.       (plus:SI (match_dup 0)
  6311.            (const_int -1)))])]
  6312.   "DATA_REG_P (operands[0])"
  6313.   "*
  6314. {
  6315.   CC_STATUS_INIT;
  6316.   output_dbcc_and_branch (operands);
  6317.   return \"\";
  6318. }")
  6319.  
  6320.  
  6321. ;; FPA multiply and add.
  6322. (define_insn ""
  6323.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  6324.     (plus:DF (mult:DF (match_operand:DF 1 "general_operand" "%x,dmF,y")
  6325.               (match_operand:DF 2 "general_operand" "xH,y,y"))
  6326.          (match_operand:DF 3 "general_operand" "xH,y,dmF")))]
  6327.    "TARGET_FPA"
  6328.    "@
  6329.     fpma%.d %1,%w2,%w3,%0
  6330.     fpma%.d %x1,%x2,%x3,%0
  6331.     fpma%.d %x1,%x2,%x3,%0")
  6332.  
  6333. (define_insn ""
  6334.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  6335.     (plus:SF (mult:SF (match_operand:SF 1 "general_operand" "%x,ydmF,y")
  6336.               (match_operand:SF 2 "general_operand" "xH,y,ydmF"))
  6337.          (match_operand:SF 3 "general_operand" "xH,ydmF,ydmF")))]
  6338.    "TARGET_FPA"
  6339.    "@
  6340.     fpma%.s %1,%w2,%w3,%0
  6341.     fpma%.s %1,%2,%3,%0
  6342.     fpma%.s %1,%2,%3,%0")
  6343.  
  6344. ;; FPA Multiply and subtract
  6345. (define_insn ""
  6346.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  6347.     (minus:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
  6348.           (mult:DF (match_operand:DF 2 "general_operand" "%xH,y,y")
  6349.                (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
  6350.   "TARGET_FPA"
  6351.   "@
  6352.    fpms%.d %3,%w2,%w1,%0
  6353.    fpms%.d %x3,%2,%x1,%0
  6354.    fpms%.d %x3,%2,%x1,%0")
  6355.  
  6356. (define_insn ""
  6357.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  6358.     (minus:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
  6359.           (mult:SF (match_operand:SF 2 "general_operand" "%xH,rmF,y")
  6360.                (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
  6361.   "TARGET_FPA"
  6362.   "@
  6363.    fpms%.s %3,%w2,%w1,%0
  6364.    fpms%.s %3,%2,%1,%0
  6365.    fpms%.s %3,%2,%1,%0")
  6366.  
  6367. (define_insn ""
  6368.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  6369.     (minus:DF (mult:DF (match_operand:DF 1 "general_operand" "%xH,y,y")
  6370.                (match_operand:DF 2 "general_operand" "x,y,rmF"))
  6371.           (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  6372.   "TARGET_FPA"
  6373.   "@
  6374.    fpmr%.d %2,%w1,%w3,%0
  6375.    fpmr%.d %x2,%1,%x3,%0
  6376.    fpmr%.d %x2,%1,%x3,%0")
  6377.  
  6378. (define_insn ""
  6379.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  6380.     (minus:SF (mult:SF (match_operand:SF 1 "general_operand" "%xH,rmF,y")
  6381.                (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  6382.           (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  6383.   "TARGET_FPA"
  6384.   "@
  6385.    fpmr%.s %2,%w1,%w3,%0
  6386.    fpmr%.s %x2,%1,%x3,%0
  6387.    fpmr%.s %x2,%1,%x3,%0")
  6388.  
  6389. ;; FPA Add and multiply
  6390. (define_insn ""
  6391.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  6392.     (mult:DF (plus:DF (match_operand:DF 1 "general_operand" "%xH,y,y")
  6393.               (match_operand:DF 2 "general_operand" "x,y,rmF"))
  6394.          (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  6395.   "TARGET_FPA"
  6396.   "@
  6397.    fpam%.d %2,%w1,%w3,%0
  6398.    fpam%.d %x2,%1,%x3,%0
  6399.    fpam%.d %x2,%1,%x3,%0")
  6400.  
  6401. (define_insn ""
  6402.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  6403.     (mult:SF (plus:SF (match_operand:SF 1 "general_operand" "%xH,rmF,y")
  6404.               (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  6405.          (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  6406.   "TARGET_FPA"
  6407.   "@
  6408.    fpam%.s %2,%w1,%w3,%0
  6409.    fpam%.s %x2,%1,%x3,%0
  6410.    fpam%.s %x2,%1,%x3,%0")
  6411.  
  6412. ;;FPA Subtract and multiply
  6413. (define_insn ""
  6414.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  6415.     (mult:DF (minus:DF (match_operand:DF 1 "general_operand" "xH,y,y")
  6416.                (match_operand:DF 2 "general_operand" "x,y,rmF"))
  6417.          (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  6418.   "TARGET_FPA"
  6419.   "@
  6420.    fpsm%.d %2,%w1,%w3,%0
  6421.    fpsm%.d %x2,%1,%x3,%0
  6422.    fpsm%.d %x2,%1,%x3,%0")
  6423.  
  6424. (define_insn ""
  6425.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  6426.     (mult:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
  6427.          (minus:DF (match_operand:DF 2 "general_operand" "xH,y,y")
  6428.                (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
  6429.   "TARGET_FPA"
  6430.   "@
  6431.    fpsm%.d %3,%w2,%w1,%0
  6432.    fpsm%.d %x3,%2,%x1,%0
  6433.    fpsm%.d %x3,%2,%x1,%0")
  6434.  
  6435. (define_insn ""
  6436.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  6437.     (mult:SF (minus:SF (match_operand:SF 1 "general_operand" "xH,rmF,y")
  6438.                (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  6439.          (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  6440.   "TARGET_FPA"
  6441.   "@
  6442.    fpsm%.s %2,%w1,%w3,%0
  6443.    fpsm%.s %x2,%1,%x3,%0
  6444.    fpsm%.s %x2,%1,%x3,%0")
  6445.  
  6446. (define_insn ""
  6447.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  6448.     (mult:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
  6449.          (minus:SF (match_operand:SF 2 "general_operand" "xH,rmF,y")
  6450.                (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
  6451.   "TARGET_FPA"
  6452.   "@
  6453.    fpsm%.s %3,%w2,%w1,%0
  6454.    fpsm%.s %x3,%2,%x1,%0
  6455.    fpsm%.s %x3,%2,%x1,%0")
  6456.  
  6457. (define_insn "tstxf"
  6458.   [(set (cc0)
  6459.     (match_operand:XF 0 "nonimmediate_operand" "fm"))]
  6460.   "TARGET_68881"
  6461.   "*
  6462. {
  6463.   cc_status.flags = CC_IN_68881;
  6464.   return \"ftst%.x %0\";
  6465. }")
  6466.  
  6467.  
  6468. (define_expand "cmpxf"
  6469.   [(set (cc0)
  6470.     (compare (match_operand:XF 0 "general_operand" "f,mG")
  6471.          (match_operand:XF 1 "general_operand" "fmG,f")))]
  6472.   "TARGET_68881"
  6473.   "
  6474. {
  6475.   if (CONSTANT_P (operands[0]))
  6476.       operands[0] = force_const_mem (XFmode, operands[0]);
  6477.   if (CONSTANT_P (operands[1]))
  6478.       operands[1] = force_const_mem (XFmode, operands[1]);
  6479. }")
  6480.  
  6481. (define_insn ""
  6482.   [(set (cc0)
  6483.     (compare (match_operand:XF 0 "nonimmediate_operand" "f,mG")
  6484.          (match_operand:XF 1 "nonimmediate_operand" "fmG,f")))]
  6485.   "TARGET_68881"
  6486.   "*
  6487. {
  6488.   cc_status.flags = CC_IN_68881;
  6489. #ifdef SGS_CMP_ORDER
  6490.   if (REG_P (operands[0]))
  6491.     {
  6492.       if (REG_P (operands[1]))
  6493.     return \"fcmp%.x %0,%1\";
  6494.       else
  6495.         return \"fcmp%.x %0,%f1\";
  6496.     }
  6497.   cc_status.flags |= CC_REVERSED;
  6498.   return \"fcmp%.x %1,%f0\";
  6499. #else
  6500.   if (REG_P (operands[0]))
  6501.     {
  6502.       if (REG_P (operands[1]))
  6503.     return \"fcmp%.x %1,%0\";
  6504.       else
  6505.         return \"fcmp%.x %f1,%0\";
  6506.     }
  6507.   cc_status.flags |= CC_REVERSED;
  6508.   return \"fcmp%.x %f0,%1\";
  6509. #endif
  6510. }")
  6511.  
  6512. (define_insn "extendsfxf2"
  6513.   [(set (match_operand:XF 0 "general_operand" "=fm,f")
  6514.     (float_extend:XF (match_operand:SF 1 "general_operand" "f,m")))]
  6515.   "TARGET_68881"
  6516.   "*
  6517. {
  6518.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  6519.     {
  6520.       if (REGNO (operands[0]) == REGNO (operands[1]))
  6521.     {
  6522.       /* Extending float to double in an fp-reg is a no-op.
  6523.          NOTICE_UPDATE_CC has already assumed that the
  6524.          cc will be set.  So cancel what it did.  */
  6525.       cc_status = cc_prev_status;
  6526.       return \"\";
  6527.     }
  6528.       return \"f%$move%.x %1,%0\";
  6529.     }
  6530.   if (FP_REG_P (operands[0]))
  6531.     return \"f%$move%.s %f1,%0\";
  6532.   return \"fmove%.x %f1,%0\";
  6533. }")
  6534.  
  6535.  
  6536. (define_insn "extenddfxf2"
  6537.   [(set (match_operand:XF 0 "general_operand" "=fm,f")
  6538.     (float_extend:XF
  6539.           (match_operand:DF 1 "general_operand" "f,m")))]
  6540.   "TARGET_68881"
  6541.   "*
  6542. {
  6543.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  6544.     {
  6545.       if (REGNO (operands[0]) == REGNO (operands[1]))
  6546.     {
  6547.       /* Extending float to double in an fp-reg is a no-op.
  6548.          NOTICE_UPDATE_CC has already assumed that the
  6549.          cc will be set.  So cancel what it did.  */
  6550.       cc_status = cc_prev_status;
  6551.       return \"\";
  6552.     }
  6553.       return \"fmove%.x %1,%0\";
  6554.     }
  6555.   if (FP_REG_P (operands[0]))
  6556.     return \"f%&move%.d %f1,%0\";
  6557.   return \"fmove%.x %f1,%0\";
  6558. }")
  6559.  
  6560. (define_insn "truncxfdf2"
  6561.   [(set (match_operand:DF 0 "general_operand" "=m,!r")
  6562.     (float_truncate:DF
  6563.           (match_operand:XF 1 "general_operand" "f,f")))]
  6564.   "TARGET_68881"
  6565.   "*
  6566. {
  6567.   if (REG_P (operands[0]))
  6568.     {
  6569.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  6570.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  6571.       return \"move%.l %+,%0\";
  6572.     }
  6573.   return \"fmove%.d %f1,%0\";
  6574. }")
  6575.  
  6576. (define_insn "truncxfsf2"
  6577.   [(set (match_operand:SF 0 "general_operand" "=dm")
  6578.     (float_truncate:SF
  6579.       (match_operand:XF 1 "general_operand" "f")))]
  6580.   "TARGET_68881"
  6581.   "fmove%.s %f1,%0")
  6582.  
  6583. (define_insn "floatsixf2"
  6584.   [(set (match_operand:XF 0 "general_operand" "=f")
  6585.     (float:XF (match_operand:SI 1 "general_operand" "dmi")))]
  6586.   "TARGET_68881"
  6587.   "fmove%.l %1,%0")
  6588.  
  6589. (define_insn "floathixf2"
  6590.   [(set (match_operand:XF 0 "general_operand" "=f")
  6591.     (float:XF (match_operand:HI 1 "general_operand" "dmn")))]
  6592.   "TARGET_68881"
  6593.   "fmove%.w %1,%0")
  6594.  
  6595. (define_insn "floatqixf2"
  6596.   [(set (match_operand:XF 0 "general_operand" "=f")
  6597.     (float:XF (match_operand:QI 1 "general_operand" "dmn")))]
  6598.   "TARGET_68881"
  6599.   "fmove%.b %1,%0")
  6600.  
  6601. (define_insn "ftruncxf2"
  6602.   [(set (match_operand:XF 0 "general_operand" "=f")
  6603.     (fix:XF (match_operand:XF 1 "general_operand" "fFm")))]
  6604.   "TARGET_68881"
  6605.   "*
  6606. {
  6607.   if (FP_REG_P (operands[1]))
  6608.     return \"fintrz%.x %f1,%0\";
  6609.   return \"fintrz%.x %f1,%0\";
  6610. }")
  6611.  
  6612. (define_insn "fixxfqi2"
  6613.   [(set (match_operand:QI 0 "general_operand" "=dm")
  6614.     (fix:QI (match_operand:XF 1 "general_operand" "f")))]
  6615.   "TARGET_68881"
  6616.   "fmove%.b %1,%0")
  6617.  
  6618. (define_insn "fixxfhi2"
  6619.   [(set (match_operand:HI 0 "general_operand" "=dm")
  6620.     (fix:HI (match_operand:XF 1 "general_operand" "f")))]
  6621.   "TARGET_68881"
  6622.   "fmove%.w %1,%0")
  6623.  
  6624. (define_insn "fixxfsi2"
  6625.   [(set (match_operand:SI 0 "general_operand" "=dm")
  6626.     (fix:SI (match_operand:XF 1 "general_operand" "f")))]
  6627.   "TARGET_68881"
  6628.   "fmove%.l %1,%0")
  6629.  
  6630. (define_expand "addxf3"
  6631.   [(set (match_operand:XF 0 "general_operand" "")
  6632.     (plus:XF (match_operand:XF 1 "general_operand" "")
  6633.          (match_operand:XF 2 "general_operand" "")))]
  6634.   "TARGET_68881"
  6635.   "
  6636. {
  6637.   if (CONSTANT_P (operands[1]))
  6638.     operands[1] = force_const_mem (XFmode, operands[1]);
  6639.   if (CONSTANT_P (operands[2]))
  6640.     operands[2] = force_const_mem (XFmode, operands[2]);
  6641. }")
  6642.  
  6643. (define_insn ""
  6644.   [(set (match_operand:XF 0 "general_operand" "=f")
  6645.     (plus:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
  6646.          (match_operand:XF 1 "general_operand" "0")))]
  6647.   "TARGET_68881"
  6648.   "fadd%.l %2,%0")
  6649.  
  6650. (define_insn ""
  6651.   [(set (match_operand:XF 0 "general_operand" "=f")
  6652.     (plus:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
  6653.          (match_operand:XF 1 "general_operand" "0")))]
  6654.   "TARGET_68881"
  6655.   "fadd%.w %2,%0")
  6656.  
  6657. (define_insn ""
  6658.   [(set (match_operand:XF 0 "general_operand" "=f")
  6659.     (plus:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
  6660.          (match_operand:XF 1 "general_operand" "0")))]
  6661.   "TARGET_68881"
  6662.   "fadd%.b %2,%0")
  6663.  
  6664. (define_insn ""
  6665.   [(set (match_operand:XF 0 "general_operand" "=f")
  6666.     (plus:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
  6667.          (match_operand:XF 2 "nonimmediate_operand" "fmG")))]
  6668.   "TARGET_68881"
  6669.   "*
  6670. {
  6671.   if (REG_P (operands[2]))
  6672.     return \"fadd%.x %2,%0\";
  6673.   return \"fadd%.x %f2,%0\";
  6674. }")
  6675.  
  6676. (define_expand "subxf3"
  6677.   [(set (match_operand:XF 0 "general_operand" "")
  6678.     (minus:XF (match_operand:XF 1 "general_operand" "")
  6679.          (match_operand:XF 2 "general_operand" "")))]
  6680.   "TARGET_68881"
  6681.   "
  6682. {
  6683.   if (CONSTANT_P (operands[1]))
  6684.     operands[1] = force_const_mem (XFmode, operands[1]);
  6685.   if (CONSTANT_P (operands[2]))
  6686.     operands[2] = force_const_mem (XFmode, operands[2]);
  6687. }")
  6688.  
  6689. (define_insn ""
  6690.   [(set (match_operand:XF 0 "general_operand" "=f")
  6691.     (minus:XF (match_operand:XF 1 "general_operand" "0")
  6692.           (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
  6693.   "TARGET_68881"
  6694.   "fsub%.l %2,%0")
  6695.  
  6696. (define_insn ""
  6697.   [(set (match_operand:XF 0 "general_operand" "=f")
  6698.     (minus:XF (match_operand:XF 1 "general_operand" "0")
  6699.           (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
  6700.   "TARGET_68881"
  6701.   "fsub%.w %2,%0")
  6702.  
  6703. (define_insn ""
  6704.   [(set (match_operand:XF 0 "general_operand" "=f")
  6705.     (minus:XF (match_operand:XF 1 "general_operand" "0")
  6706.           (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
  6707.   "TARGET_68881"
  6708.   "fsub%.b %2,%0")
  6709.  
  6710. (define_insn ""
  6711.   [(set (match_operand:XF 0 "general_operand" "=f")
  6712.     (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
  6713.          (match_operand:XF 2 "nonimmediate_operand" "fmG")))]
  6714.   "TARGET_68881"
  6715.   "*
  6716. {
  6717.   if (REG_P (operands[2]))
  6718.     return \"fsub%.x %2,%0\";
  6719.   return \"fsub%.x %f2,%0\";
  6720. }")
  6721.  
  6722. (define_expand "mulxf3"
  6723.   [(set (match_operand:XF 0 "general_operand" "")
  6724.     (mult:XF (match_operand:XF 1 "general_operand" "")
  6725.         (match_operand:XF 2 "general_operand" "")))]
  6726.   "TARGET_68881"
  6727.   "
  6728. {
  6729.   if (CONSTANT_P (operands[1]))
  6730.     operands[1] = force_const_mem (XFmode, operands[1]);
  6731.   if (CONSTANT_P (operands[2]))
  6732.     operands[2] = force_const_mem (XFmode, operands[2]);
  6733. }")
  6734.  
  6735. (define_insn ""
  6736.   [(set (match_operand:XF 0 "general_operand" "=f")
  6737.     (mult:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
  6738.          (match_operand:XF 1 "general_operand" "0")))]
  6739.   "TARGET_68881"
  6740.   "fmul%.l %2,%0")
  6741.  
  6742. (define_insn ""
  6743.   [(set (match_operand:XF 0 "general_operand" "=f")
  6744.     (mult:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
  6745.          (match_operand:XF 1 "general_operand" "0")))]
  6746.   "TARGET_68881"
  6747.   "fmul%.w %2,%0")
  6748.  
  6749. (define_insn ""
  6750.   [(set (match_operand:XF 0 "general_operand" "=f")
  6751.     (mult:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
  6752.          (match_operand:XF 1 "general_operand" "0")))]
  6753.   "TARGET_68881"
  6754.   "fmul%.b %2,%0")
  6755.  
  6756. (define_insn ""
  6757.   [(set (match_operand:XF 0 "general_operand" "=f")
  6758.     (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
  6759.         (match_operand:XF 2 "nonimmediate_operand" "fmG")))]
  6760.   "TARGET_68881"
  6761.   "*
  6762. {
  6763.   if (REG_P (operands[2]))
  6764.     return \"fmul%.x %2,%0\";
  6765.   return \"fmul%.x %f2,%0\";
  6766. }")
  6767.  
  6768. (define_expand "divxf3"
  6769.   [(set (match_operand:XF 0 "general_operand" "")
  6770.     (div:XF (match_operand:XF 1 "general_operand" "")
  6771.         (match_operand:XF 2 "general_operand" "")))]
  6772.   "TARGET_68881"
  6773.   "
  6774. {
  6775.   if (CONSTANT_P (operands[1]))
  6776.     operands[1] = force_const_mem (XFmode, operands[1]);
  6777.   if (CONSTANT_P (operands[2]))
  6778.     operands[2] = force_const_mem (XFmode, operands[2]);
  6779. }")
  6780.  
  6781. (define_insn ""
  6782.   [(set (match_operand:XF 0 "general_operand" "=f")
  6783.     (div:XF (match_operand:XF 1 "general_operand" "0")
  6784.         (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
  6785.   "TARGET_68881"
  6786.   "fdiv%.l %2,%0")
  6787.  
  6788. (define_insn ""
  6789.   [(set (match_operand:XF 0 "general_operand" "=f")
  6790.     (div:XF (match_operand:XF 1 "general_operand" "0")
  6791.         (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
  6792.   "TARGET_68881"
  6793.   "fdiv%.w %2,%0")
  6794.  
  6795. (define_insn ""
  6796.   [(set (match_operand:XF 0 "general_operand" "=f")
  6797.     (div:XF (match_operand:XF 1 "general_operand" "0")
  6798.         (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
  6799.   "TARGET_68881"
  6800.   "fdiv%.b %2,%0")
  6801.  
  6802. (define_insn ""
  6803.   [(set (match_operand:XF 0 "general_operand" "=f")
  6804.     (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
  6805.         (match_operand:XF 2 "nonimmediate_operand" "fmG")))]
  6806.   "TARGET_68881"
  6807.   "*
  6808. {
  6809.   if (REG_P (operands[2]))
  6810.     return \"fdiv%.x %2,%0\";
  6811.   return \"fdiv%.x %f2,%0\";
  6812. }")
  6813.  
  6814. (define_expand "negxf2"
  6815.   [(set (match_operand:XF 0 "general_operand" "")
  6816.     (neg:XF (match_operand:XF 1 "general_operand" "")))]
  6817.   ""
  6818.   "
  6819. {
  6820.   /* ??? There isn't an FPA define_insn so we could handle it here too.
  6821.      For now we don't (paranoia).  */
  6822.   if (!TARGET_FPA && !TARGET_68881)
  6823.     {
  6824.       rtx result;
  6825.       rtx target;
  6826.       rtx insns;
  6827.  
  6828.       start_sequence ();
  6829.       target = operand_subword (operands[0], 0, 1, XFmode);
  6830.       result = expand_binop (SImode, xor_optab,
  6831.                  operand_subword_force (operands[1], 0, XFmode),
  6832.                  GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
  6833.       if (result == 0)
  6834.     abort ();
  6835.  
  6836.       if (result != target)
  6837.     emit_move_insn (result, target);
  6838.   
  6839.       emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
  6840.               operand_subword_force (operands[1], 1, XFmode));
  6841.       emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
  6842.               operand_subword_force (operands[1], 2, XFmode));
  6843.  
  6844.       insns = get_insns ();
  6845.       end_sequence ();
  6846.  
  6847.       emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
  6848.       DONE;
  6849.     }
  6850. }")
  6851.  
  6852. (define_insn "negxf2_68881"
  6853.   [(set (match_operand:XF 0 "general_operand" "=f")
  6854.     (neg:XF (match_operand:XF 1 "nonimmediate_operand" "fmF")))]
  6855.   "TARGET_68881"
  6856.   "*
  6857. {
  6858.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  6859.     return \"fneg%.x %1,%0\";
  6860.   return \"fneg%.x %f1,%0\";
  6861. }")
  6862.  
  6863. (define_expand "absxf2"
  6864.   [(set (match_operand:XF 0 "general_operand" "")
  6865.     (abs:XF (match_operand:XF 1 "general_operand" "")))]
  6866.   ""
  6867.   "
  6868. {
  6869.   /* ??? There isn't an FPA define_insn so we could handle it here too.
  6870.      For now we don't (paranoia).  */
  6871.   if (!TARGET_FPA && !TARGET_68881)
  6872.     {
  6873.       rtx result;
  6874.       rtx target;
  6875.       rtx insns;
  6876.  
  6877.       start_sequence ();
  6878.       target = operand_subword (operands[0], 0, 1, XFmode);
  6879.       result = expand_binop (SImode, and_optab,
  6880.                  operand_subword_force (operands[1], 0, XFmode),
  6881.                  GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN);
  6882.       if (result == 0)
  6883.     abort ();
  6884.  
  6885.       if (result != target)
  6886.     emit_move_insn (result, target);
  6887.   
  6888.       emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
  6889.               operand_subword_force (operands[1], 1, XFmode));
  6890.       emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
  6891.               operand_subword_force (operands[1], 2, XFmode));
  6892.  
  6893.       insns = get_insns ();
  6894.       end_sequence ();
  6895.  
  6896.       emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
  6897.       DONE;
  6898.     }
  6899. }")
  6900.  
  6901. (define_insn "absxf2_68881"
  6902.   [(set (match_operand:XF 0 "general_operand" "=f")
  6903.     (abs:XF (match_operand:XF 1 "nonimmediate_operand" "fmF")))]
  6904.   "TARGET_68881"
  6905.   "*
  6906. {
  6907.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  6908.     return \"fabs%.x %1,%0\";
  6909.   return \"fabs%.x %f1,%0\";
  6910. }")
  6911.  
  6912. (define_insn "sqrtxf2"
  6913.   [(set (match_operand:XF 0 "general_operand" "=f")
  6914.     (sqrt:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
  6915.   "TARGET_68881"
  6916.   "*
  6917. {
  6918.     return \"fsqrt%.x %1,%0\";
  6919. }")
  6920.  
  6921. (define_insn "sinsf2"
  6922.   [(set (match_operand:SF 0 "general_operand" "=f")
  6923.     (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] 1))]
  6924.   "TARGET_68881 && flag_fast_math"
  6925.   "*
  6926. {
  6927.   if (FP_REG_P (operands[1]))
  6928.     return \"fsin%.x %1,%0\";
  6929.   else
  6930.     return \"fsin%.s %1,%0\";
  6931. }")
  6932.  
  6933. (define_insn "sindf2"
  6934.   [(set (match_operand:DF 0 "general_operand" "=f")
  6935.     (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] 1))]
  6936.   "TARGET_68881 && flag_fast_math"
  6937.   "*
  6938. {
  6939.   if (FP_REG_P (operands[1]))
  6940.     return \"fsin%.x %1,%0\";
  6941.   else
  6942.     return \"fsin%.d %1,%0\";
  6943. }")
  6944.  
  6945. (define_insn "sinxf2"
  6946.   [(set (match_operand:XF 0 "general_operand" "=f")
  6947.     (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] 1))]
  6948.   "TARGET_68881 && flag_fast_math"
  6949.   "*
  6950. {
  6951.     return \"fsin%.x %1,%0\";
  6952. }")
  6953.  
  6954. (define_insn "cossf2"
  6955.   [(set (match_operand:SF 0 "general_operand" "=f")
  6956.     (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] 2))]
  6957.   "TARGET_68881 && flag_fast_math"
  6958.   "*
  6959. {
  6960.   if (FP_REG_P (operands[1]))
  6961.     return \"fcos%.x %1,%0\";
  6962.   else
  6963.     return \"fcos%.s %1,%0\";
  6964. }")
  6965.  
  6966. (define_insn "cosdf2"
  6967.   [(set (match_operand:DF 0 "general_operand" "=f")
  6968.     (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] 2))]
  6969.   "TARGET_68881 && flag_fast_math"
  6970.   "*
  6971. {
  6972.   if (FP_REG_P (operands[1]))
  6973.     return \"fcos%.x %1,%0\";
  6974.   else
  6975.     return \"fcos%.d %1,%0\";
  6976. }")
  6977.  
  6978. (define_insn "cosxf2"
  6979.   [(set (match_operand:XF 0 "general_operand" "=f")
  6980.     (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] 2))]
  6981.   "TARGET_68881 && flag_fast_math"
  6982.   "*
  6983. {
  6984.     return \"fcos%.x %1,%0\";
  6985. }")
  6986.